http://qs1969.pair.com?node_id=502607


in reply to Re: seeds...
in thread seeds...

We all know how cool it is (clever, intriguing, sexy, etc) to write Perl code that is highly idiomatic, tersely compact, even ethereally abstracted. But this sort of usage will pose problems for maintenance, especially in shops where Perl is only one of several available tools (and not necessarily the predominant one).

*shudder* Where does that horrid "cleverness" mentality come from, anyway?!? What happened to professionalism; the KISS principle; clean, obvious code that doesn't require wasted thought or effort to maintain?

I see so many would-be clever programmers using complex idioms for the sake of cleverness; playing games with scoping, closures, OO to implement a theoretically elegant solution that's convoluted, hard to maintain, and hard to test.

Sometimes it's simpler to just plain write:

print "Hello, World";
and be done with it, rather than some "sophisticated" mess like:
use Config::Parser; # "clever" in house module to parse config files; +relies heavily on closures, XS, and mutual recursion; contains own le +xer and parser use Language::Gylph::Unicode; # "clever" in house module for unicode; +written in as a clever polyglot of FORTRAN, C, and Assembler, "just i +n case" only one of the languages is available at any given time my $parser; $parser = Config::Parser->new( $ARGV[0] || $ENV{CONFIG} || get_default +_config($0) ); $parser->set_output_device(\*STDOUT); $parser->set_Encoding( Language::Glyph::Unicode->get_encoding( $ENV{LA +NGUAGE} ) ); $parser->set_display_string( $parser->get_data(TYPE=>GREETING)); $parser->output_display_string();
where the hastily written perldocs for the parser claim that only ASCII encoding is currently supported, and the entire target audience speaks only English, and only has access to 7-bit ascii text terminals. And yes, I've seen code that ugly before! :-(

I see sooo much over-engineering, would-be cleverness, and solving of non-problems in my workplace that I'm perhaps oversensitive to it, but I find that "clever" is far too often code for "writing obfuscated code to stroke my own ego, and protect my job security"; my ex-boss did this for several years, and completely destroyed all semblence of maintainable code here at my company. :-( I'd re-write it, but I'm not allowed to until it breaks. :-(

So, perhaps as a reaction to that, I very much prefer the K.I.S.S principle; make it work, and make it obvious. Be clear on your own time; don't waste your co-workers time on ugly idioms unless the idiom is necessary, and not just "cute". "Cute, clever, and tricky" is quite often the opposite of "simple, obvious, and correct", at least in my experience.