| < Day Day Up > |
|
The symptoms of Complexification are:
Poor readability might indicate overly complex code, but further investigation is necessary to determine if complex code is the root cause of the poor readability.
The performance of extra computation that is undetectable to the end user.
Use of an algorithm primarily because it was the most recently learned.
The emergence of bugs caused by the overly complex interactions between objects or other code units.
To prevent Complexification:
K.I.S.S., or Keep It Simple, Stupid
Know or learn what algorithms will work for the problem.
Start with the simplest or most well known algorithm, and only add complexity as necessary.
If the option is available, choose the best programming language implementing the algorithm.
Test how difficult it is to explain the algorithm, preferably to a colleague not working on the associated problem.
Perform refactoring early and often to reduce the complexity of interactions between code units.
To cure the effects of Complexification:
Do not be afraid to refactor to a less optimal but more general solution as long as the general solution still meets the requirements.
Determine the least restrictive requirements that still solve the problem, and then choose the simplest algorithm that meets these requirements.
Clean up code after simplifying to remove dead code and incorrect comments.
| < Day Day Up > |
|