What to document?

When writing documentation one needs to know down to which level of granularity documentation needs to be provided.

At the very least, every Pascal unit should be documented to some degree. One can suffice with a one-liner if the contents of the unit is trivial. However, please take your time in determining whether you can provide extra information that is relevant to the user of the code but is not clear from the code itself. Ideally units are focused and coherent, which makes the unit level a reasonable minimum level. However, when a unit is large and declares a lot of symbols one should more thoroughly document the contents of the unit.

Assume that the audience has a thorough programming background. This means that you should not try to explain everything. Instead use terminology that is common in the field and refer to design patterns and standards when appropriate. Rely on the audience to have the necessary knowledge already, or to be able to acquire this knowledge when needed. Please do explain how aspects of the code are different from what an experienced programmer might expect.