Thursday, February 2, 2012

TIMTOWTDI doesn't mean anything goes

Perl is a language that provides a lot of freedom. The philosophy of
"There's more than one way to do it", allows coders to be as
expressive and creative as they want to be. Unfortunately this
provides the impression that one has license to eschew best

Nothing could be further from the truth. As they say, with freedom
comes great responsibility. Sure, when you are writing one liners or
scrap code who cares, but when you are writing something serious
please make it easy to read.

I have seen too many nested ternary operators within nested maps to
forget the pain that unclear code can be to manage. What's more is I
can't understand why someone would do things like this. Yes, by some
miracle the code worked but could the original author make any sense
of it? Did they care?

Then there are the indestructible spaghetti blobs. These happen when
somebody doesn't feel like segmenting their code into reusable chunks.
So you end up having to make 5-10 small changes spread out amongst
1000 lines in order to work on the same feature.

Whoever writes this kind of code in a group setting is being
inconsiderate to any future maintainer. And if the only maintainer is
the author then they are still only hurting themselves. Sure, there may
be more than one way to do it, but please make it a manageable one.

No comments:

Post a Comment