Documented Code
Most code documentation goes into the code, but this is simply a set of comments telling what individual pieces of code do. Code documentation also requires a bigger overview of the structure of the code and the interface interacts with the domain code.
Domain and Interface Code
Most applications have domain code and interface code. Domain code is all that code that encapsulates the rules of the application. It will include objects, methods, functions, routines, variables, and code blocks. Interface Code controls how the interface behaves and typically interacts with the Domain Code. For example, you would NOT send information to the database straight from the interface. The information would be collected from the interface into domain code which validates it and then sends it on to the database.
Interface Code
Some logic will always be included in the interface, specific interface requirements will go here and how these will be done in the interface. For example, if a user needs to Select a City after Selecting a State – how will you filter the City list based on the State selected? Will you use AJAX or refresh the screen? How are you doing these things? Where are you getting the lists of states and cities from?
Domain Code
When coding I try to encapsulate everything that is domain-specific into objects that are separated from the interface. The domain should be independent of the UI, the interface code, on the other hand, can have full awareness of the domain code. You must document how this code is organized and how it works. Using our example you could have domain code ListManager with the method allStates() which answers all the states for the interface. It could also have citiesForState(stateName) which answers the cities for a given state. You need to document how you organize this.