I'm new to German and I get a bit confused about when it's "dem" or "im" or "den" rather than "in der" or "in dem" and so on.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
In many languages, prepositions and articles are sometimes contracted.
Contractions that may occur in informal speech:
As for choosing between different cases:
This corresponds to the knowledge of deciding if the correct English sentence is "I touch you." or "I touch to you." and very often, the construction with "to" corresponds to dative in German and without it to accusative in German. In the light of the next phrase it can be more helpful to think of the action being done "for" someone when the dative is used.
For prepositions again, you should learn what case they demand, but an important rule is: If the meaning is where something is, then the object has to take the dative, if the meaning is where it moves to, then the object has to take the accusative. Note that this deviates from the correspondence with "to" in the previous paragraph.
It would be good to ask a more specific question if you want to know more.
In informal speech, uncontracted expressions like in dem Haus, an der Strasse etc. may occur, but always in a meaning like in diesem Haus or an dieser Strasse.
Und noch mehr:
Aber die Frage war "when would one ..." :
Praktisch immer, ausser in sehr förmlichen Texten, wie in Gesetzestexten oder behördlichen Schreiben.
In written German, use only the contractions listed by Phira.
If you are in doubt, I would advise not using contractions, as they tend to sound a little "uncouth" if overused.