drieuxster (drieuxster) wrote,
drieuxster
drieuxster

Bad Code Does Not Get Better On Bad Drugs....

Now bear with me children if the phrases get technical, since, this is brief bit, of
Bad Code CAN can Bad Drug Abuse!!!
So Just Say NO!!!
Now I don't mind the problem of the cannonical Labelled Autonomous Block that allows one the gag:
INVALID: {
    .....
    $errmsg = $errcode . '_token';
    last INVALID;
since this allows one to collect up some stuff from the start of the block and bail out at any given instance and arrive at the end of the block with some set of flags set, that will of course be resolved with the classic
if ($error) {
    # Oh that was not suppose to happen
    DealWithEmotionalTraumaInCode($error, $errmsg, $issue, @angst);
When I start trying to figure out which one of the UNNAMED CURLY BRACES IS ALLEDGED TO BE THE END GAME POINT!!!!

At which point I start trying to tab indent things to make a bit of sense, then I get to the Scary
eval { $tok->trylogin }
if ($@) {
    if (ref($@) eq '.........::Exception') {
      for($@) {
        /EXISTS/ do { ....
MAKE IT STOP!!!!

MOMMY MAKE IT STOP!!!! MAKE THE BAD MAN GO AWAY!!!!

yes boys and girls, nested in the $tok's perl module was this neat little HORROR
{
 package .........::Exception;
 sub new { bless { code => $_[1] }, $_[0]; }
so that yes, there in the HORRORS of the trylogin() method was not one but several dysfunctional failure modes that would be Blown into this Exception Class and Passed up the Pipe in a 'die'....

Oh Me, Oh My!!! Someone had been doing very rude and unnatural things with Java late at night and clearly got some of it stuck all over their pet favorite blew dress....

So I did the nasty thing - and declared a hash of the OINK, with a Capital Letter Token for the Index, and the nice error message that it was short for... and I wrote an accessor that would take in the Token, and would get the message, and if the Token was not 'OK' then it would return the errno as 1, vice 0.... This leads to the Ugly Coding Interface:
my ($err_code,$e_msg) = $tok->login();
    if($err_code){
      $errmsg = $e_msg;
      last VALID;
     }
WOW!!!

Yes, it looks, well, like, uh, DULL and BORING!! and it does not requirer large volumes of troops in afghanistan to help facilitate lowering the global cost of heroin....

No fancy Eval, No GROTTING around in the fancy perl tokens, to find the Majik Special Super Sauce, that will help one understand that.....

Ah yes, at that point we started to just RIP OUT the dross and then, slowly, and surely, it is coming that I can find out which of the unNamed Curly Braces gets us to the end of the Labelled One.

At which point I write a comment bar noting that this is the end of the lost misadventure....

Ah yes, the fun of some sorts of Kode Like Behavior.
Subscribe

  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments