Maintainable code is part and parcel of well-written software.
Clean code. Clean code. CLEAN CODE.
All software should be cleanly written.
Because the major cost of software is maintenance, not development!
Clean code requires a number of vital factors:
Correct syntax (compiler, lint, validator)
Correct semantics (lint, link checker)
Correct spelling (spell checker)
Documented code (javadoc, perldoc)
Clean Code style guidelines (TBD...)
Computer languagesmay be classified as
compiled (e.g. C, Java, Perl) or
Actually Java and Perl could both be considered semi-compiled, though
quite different from each other.
Computer programsmay be classified as
standalone (C, Java, Perl) or
Encapsulated has different meanings depending on context;
here I use the term to mean executed from within an enclosed environment.
(While that's technically true of all programs,
convention--and common sense--draw the separation at the command line.)
So depending on the language and the environment,
the issues to consider for Clean Code vary considerably.
Basically, though, there are issues
of correctness and issues of style.
This section discusses program correctness,
that is, getting the syntax and the semantics right.
This is perhaps easier than the style question,
since there is a whole host of tools to aid in this endeavor.
First, an explication of the types of errors which you will face:
always caught by the compiler.
compiled or semi-compiled languages such as C, C++, Java, etc.
failure mode: compiler reports error message
Linking/loading errors (fully compiled languages)
always caught by the compiler,
as all references are determined before execution.