www.bahn.de is the site for the trains in Germany. Don't really know much about buses in Germany, but the trains are great: reliable and comfortable.
Generally, the faster the train and the less stops, the more expensive it will be. I booked trains a day or so in advance when I was there just at the ticket window of a train station (a different station to the one I was actually going to leave from). A very painless experience considering the issues I used to go through when buying bus tickets with EuroLines. over 10 years ago
See my general answer here: http://travellr.com/questions/germany/1474/cheapest-way-from-hamburg-to-stralsund over 10 years ago