A case against the saying that “well written code does not need clarification or comments�
Here is some well-written code:
Code:
int nIMin = m_nIMax;
int nIMax = m_nIMin;
int nJMin = m_nJMax;
int nJMax = m_nJMin;
So is it a bug? Did anyone notice? I can hear you protest now that you would need to see it in context to know. However, if I add a single short comment:
Code:
int nIMin = m_nIMax; // initialize to opposite ends of range
int nIMax = m_nIMin;
int nJMin = m_nJMax;
int nJMax = m_nJMin;
You know that the intent was to initialize max with min and min with max.
There is no way to express this in the code itself, and this kind of situation crops up all the time in well-written code of even moderate complexity. People with limited imaginations, who lack the capacity to see that their code could be read in many different ways, are generally unable to grasp this point, even when presented with multiple examples
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest (c) 2006 by Group29 Productions.
You can syndicate Group29 Productions news with an RSS Feeder using the file backend.php