Over Engineering, Wheel Re-Invention, and Other Diseases

Writing code from scratch, without any prior design or plan, is a very bad programming practice. However, the opposite, namely over-engineering, can be just as harmful. In essence, over engineering is the use of costly, redundant or “cute” features that are not truly necessary. A good example of this is using exception handling as an alternative to ordinary control constructs such as loops and while statements. Likewise, templatizing a class that is never used for more than a single type is an expensive and totally redundant task. Excessive typedef’s and classes that simply replace built-in data types are other instances over enthusiastic code scribbling. Finally, “cute” features and puns such as the use of bitwise operators, macro tricks, or function pointers can also result in unreadable code. However, the worst bad habit is re-inventing the wheel. Writing custom container classes and algorithms instead of using the ones that already exist in C++ (in the form of STL) is a very expensive, bug prone, and totally uncalled for practice. One of the phases of design review and code review should consist of catching and sifting such instances of over-engineering, wheel re-invention, and “poetry”.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: