36 ms·
I doubt there are many who would argue that Drupal is crappy software. And here's the shocker: it uses globals and most of it is procedural PHP! Let that sink i
by pacemkr 16y ago
I doubt there are many who would argue that Drupal is crappy software. And here's the shocker: it uses globals and most of it is procedural PHP! Let that sink in... Signs alone do not prove guilt. =P
But -- just to be a hypocrite -- my number one sign of crappy software is deeply nested if statements. The more you branch the more loose ends you have to juggle up in the air as your solution is formulating.
Just to be productive, allow me to share a tool that has evaded me for many years: assertions. No really!
function GoodFunction
assert(good_state)
do_one_thing_very_well
Reads better, and leads to better design than:
function GoodFunction?
if( oh_right )
do_one_thing_very_well_slightly_differently
else
do_one_thing_very_well
In the first the oh_right condition just doesn't fit in and you start thinking about what caused this logical branch in the first place. In the second we feel little hesitation to add an elseif if need be, further increasing complexity.
To give credit where its due, "Coders at Work" has actually changed my coding style. I highly recommend the book.