Definition Ordering

Some programming languages require that types/classes/function/subroutines be defined in bottom-up order: that is, one must fully define element E before one can define any elements that use E. However, many languages allow definitions to occur in a source file in any order, provided that any necessary forward declarations are included.

How do people order their definitions in source files, and why?

The goals of any deliberate ordering routine would be:

With use of source code browsers, LiterateProgramming, and other tools, the physical order of definitions is often irrelevant to a reader. However, a logical ordering can help a reader to learn the relationships between definitions.

Some organizational techniques are:


See also:


CategorySourceManagement CategoryDefinition


EditText of this page (last edited August 14, 2010) or FindPage with title or text search