arborint wrote:Hockey wrote:This is not intended to disscuss the finer points of KISS or good design, but rather start a disscussion on advanced coding techniques which might have negative implications in the long run.
I am not sure that the example you gave is "advanced" -- it sounds more like a "bad coding technique" on several levels. It uses globals and does not encapsulate related data in some kind of container that clearly identifies the contents to the programmer (e.g. $config). I think that bad coding techniques can be identified by using code smells to check for them in code.
It's an advanced technique (relative to PHP development)...I see it quite often in programmers with a few years programming experience...
I say advanced because the less experienced I have worked with generally don't think or try to automate such initializations...instead they do it manually
Code: Select all
$GLOBALS['blah'] = "blah";
$GLOBALS['blah'] = "blah";
$GLOBALS['blah'] = "blah";
$GLOBALS['blah'] = "blah";
This is much clearer (ignoring the fact globals are being used) than an automated FOR loop which does all the magic for you...easier to find using a grep...and so on
I dunno about you, but as a contract developer I work on *many* existing codebases which range from great to garbage...so I have little choice but to accept good or bad programming practices...make good with what I'm given...
I see plenty of advanced coding techniques which are generally bad practice...this is often caused by skilled developers and the mindset "If it was difficult to write it should be equally difficult to understand"
Consider the >> operator as an example...many C developers use advanced shift techniques to execute faster multiplication/division by powers of 2...while this did yield faster code on many platforms (now compilers take care of this for you) it also obfuscated the source slightly...
Someone not familiar with shifting tricks might take longer than nessecary in locating the culprit code...looking for a * or / operator NOT a >> or <<
The whole pupose of KISS is to make things as explicit as possible - self documenting code using high level API's and so on. Easy to understand not just for the original developer but someone coming in later (like me) when s*it hits the fan
Don't get me wrong, I love sifting through advanced code (assembler, C/C++, etc) but when I have a job to do and time is money I want results ASAP as time is a relfection of my performance...so KISS is the impetus to in my development...
Cheers
