How do we represent a molecule in text form?
The representation of a molecule in text form actually has a name: the chemical formula (pl. formulae).

The formula we use for everyday purposes is an empirical formula. That article should give you more information, but in a nutshell, it is a simple way of identifying a compound by the ratio of its constituent elements. Since ionic compounds and other compounds such as macromolecules can have huge absolute numbers of atoms which are technically bonded but in practice are subdivided into their simplest components, empirical formulae are useful for unambiguously identifying most compounds. Note, however, that we run into trouble when talking about isomers or other compounds with the same elemental ratio but different structures.

For these compounds, we must disambiguate by using a structural formula, which is basically a graph of the molecule. Translating this into text can be done many different ways, using a formal system for specifying branches and stereochemistry. The three most widely used formats for chemical database applications are SMILES, PDB, and CML. You can get more information on all these from Open Babel (alternately OpenBabel).

There is also a middle ground, using a formula similar to SMILES, variously called a molecular formula or condensed formula. It implies structure by counting every atom and splitting individual elements apart to show functional groups like hydroxyl ($\ce{-OH}$) or amino ($\ce{-NH2}$) bonded to the main structure.

I think this is what your question is really about. Yes, in a condensed formula, the order of elements and functional groups matters, because you are trying to communicate information about a compound's structure with a minimum of overhead. It wouldn't make sense to say that butyraldehyde is $\ce{C2H4CHOCH3}$ because the formyl group is at the end. Therefore we say butyraldehyde is $\ce{CH3(CH2)2CHO}$ to better represent the compound's structure. This helps distinguish isomers (but not stereoisomers). Even using the Hill system, one must still be careful.

I hope this clears things up for you on how chemists use different formulae in different situations, and how a condensed formula works.