-
Book Overview & Buying
-
Table Of Contents
Modern Programming: Object Oriented Programming and Best Practices
By :
There are, in many applications, plenty of features that are trivial to implement but must be done over and over. Perhaps it's taking an array of model objects and preparing a list view, creating classes from database schemata, or creating a list of compile-time constants from a text file.
These situations can usually be automated by generating code. The idea is to express the problem in a succinct representation, then translate that into something that can be incorporated into your program. This is pretty much what a compiler does; though many programming languages are far from succinct, they're still much less unwieldy than the machine's native instruction code.
Just as a code generator makes it easier to create a product, it makes it harder to debug. For a concrete example, consider the autotools build system discussed earlier in this chapter. Imagine that a developer is looking into a reported problem...
Change the font size
Change margin width
Change background colour