|Syntactic Confectionery Delight|
Re^5: "Cleverness" from HOPby gwadej (Chaplain)
|on Jun 11, 2009 at 19:54 UTC||Need Help??|
Much of the clever code I've seen in my career was more complicated or obscure than necessary, not just written without an eye toward consequences.
An example may help explain what I see as clever code.
A couple of years ago, I worked on a system where a programmer built a lazy-loading system with built-in cache to make certain that we didn't load the data from disk unless we really needed it. Finding when and where data was read and written was a huge amount of effort. When I eventually talked to the original programmer, I was told that we needed to do this because we might have 10,000 data points. Unfortunately, these were 4-byte data points.
40K was nothing compared to the data we were working with. Despite that fact, several programmers over a period of about a decade had had to fight with this clever code that protected us from unnecessarily loading data.
In another place in the code, I ran across an N^3 algorithm that had worked fine for 5 elements, but didn't seem to work too well with a couple of hundred elements.
The first example was clever, the second did not consider consequences.