[UPHPU] OT: Code Readability (was: short syntax without the else?)
Dave Smith
dave at thesmithfam.org
Mon Jan 21 11:13:18 MST 2008
Scott Hill wrote:
> If the problem is solved, isn't our code OK?
I respectfully disagree. If your code is difficult to read and maintain,
you may have solved one problem, but you've created a new one. And it
will cost you and your company in the medium and long term. It has
nothing to do with micro-managing bosses or school assignments (in fact,
in school I never had anyone review my code for readability). I hope I'm
not arguing out of place here. I'm talking about readability, and not so
much performance or efficiency.
I've had to maintain people's sloppy code in the past, and it is very
expensive, both in terms of the time I spend on it, and the frustration
levels I reach trying to understand it and modify it without introducing
new bugs. I've also maintained well-written code, and the difference is
approximately one order of magnitude in effort. That is to say, it is 10
times more expensive in my experience to fix bugs and add features in
code that is sloppily written and poorly documented.
In my experience, this may not be as important on small projects, but on
medium-sized and large projects, it is crucial to the success of the
project.
This discussion reminds me of Joel Spolsky's article where he describes
a good programmer as "smart and gets things done" [1]. According to
Joel, people who "get things done" (ie, solve the problem) but aren't
"smart" (ie, write crappy code) tend to solve problems in the short
term, but they create huge problems down the road. I'm not suggesting
that you're one of those people. Based on your posts in the past, I'm
confident you are both smart and get things done, so hopefully no
offense is taken.
Just a couple more cents for the pile. :)
--Dave
[1] http://www.joelonsoftware.com/articles/fog0000000073.html
More information about the UPHPU
mailing list