http://qs321.pair.com?node_id=11118618


in reply to Re^2: Working with old code
in thread Working with old code

«...a sound reason...»

Sure. Consider this true story: Once upon a time a young C programmer needed a little script. In his hubris - a real Dr Wisenheimer - he wrote it in an obsolete Perl 4 style. Everything self made. No libs etc. Some years later a bash programmer (a real Perl hater) inherited the script. At this point the little script was already swollen to a monster of many hundred lines of code. The basher left the company and a real Java fan boy inherited it. He added tons of features and libs. Now this whole crap is by far > 1000 lines and really stinks. It is mission-critical. If it fails: Airplanes grounded, 100 printers down, VPNs broken, monitoring runs amok, what ever desaster you can imagine. And a poor 24/7 admin needed to restart the stuff every time it crashed. Sure, this is prose. A short summary of my experience. The statement is: Sometimes it’s better to make a hard break. Who will be killed if such crap fails? The poor guy which inherited it. And: If you want to maintain or extend such stuff you need to understand it’s logic. BTW, my second project ever was a complete rewrite of the crap I wrote in my first project. After I «discovered» how it really should be done.

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Replies are listed 'Best First'.
Re^4: Working with old code
by eyepopslikeamosquito (Archbishop) on Jun 28, 2020 at 11:31 UTC

    Let me get this straight. It started with a small Perl 4 style script, written in Perl 5 by a hubristic C programmer? Did the basher rewrite it in bash? Or just add some bash to the existing Perl 4-style Perl 5 script? Did the Java fan boy rewrite the whole thing in Java, or just add some Java to the existing Perl 4-style Perl 5/bash hybrid? ... I agree that a "Perl4-style Perl 5-bash-Java hybrid" written by a C programmer is probably ripe for a complete rewrite. :)

    my second project ever was a complete rewrite of the crap I wrote in my first project. After I discovered how it really should be done
    Sure, this can work well ... like the Perl 5 rewrite of Perl 4 ... or not so well, like the Perl 6 rewrite of Perl 5. :) Beware the Second-system effect.

      All pure Perl. But everybody speaks his second or third language with some less or more strong accent. Like me when I talk English like Armin Müller-Stahl in «Night On Earth» by Jim Jarmusch. The C guy declared all variables on top and used C-style loops. The Bash guy shelled out whenever possible and added an extremely long main part. The Java guy turned the whole thing into bloatware. Just to mention a few issues. Best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

      perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

        Successful software development is a long term activity. If you plan to be successful, you should therefore plan for your code base to be maintained by a succession of many different programmers over a period of many years. Not planning for that is planning to fail.

        -- from Why Create Coding Standards and Perform Code Reviews?

        Sounds like you might have benefited from code reviews and a company coding standard. BTW, I see that Perl monk JavaFan was very dubious of the benefit of a company coding standard in Why Create Coding Standards and Perform Code Reviews? Maybe he was the "Java fan boy" in your old company? :)

        Though we've had a company Perl coding standard for many years, consistently enforcing it was problematic. It still exists but is advisory only, rarely enforced. Peer code reviews are still mandatory.