Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • In the extreme, this is called a developmestuction environment [thedailywtf.com].

    It is the most horrible habit ever – the most horrible possible habit.

    Dare to delete, people! Does the code need to be there? Really? If it’s not absolutely necessary, why keep it? If you end up needing it, you can always go back through the revision history. (You’re not a dilettante and do have source control, right? Right?) At worst, leave a comment and mention the source control revision in which the deleted code can be

    • I once boasted that I had deleted more code at $JOB than I had written. I'm afraid that isn't quite true -- then or now -- but I like to think that I keep the ratio pretty close to 1.

      I love the feeling of deleting awful old code. It's like, I don't know, throwing away my meds for some horrible disease I've overcome.
      --
      rjbs
  • But I agree, deletion is a privilege we sometimes forget that we have and there is nothing like the feeling of cleaning up code.

    I should schedule some regular refactoring session, just to get that special kick, I have seen several DRY violations in the code base.

    But again, time is not on my side.
    • Yeah, time pressure can make you do horrible things to a codebase. I know all too well.

      As for tough, well… I can’t really put this in few words, because it’s a big issue with many sides. The best I have seen it explained is by MJD in his Program Repair Shop talk at last year’s YAPC::Asia [google.com]. I really recommend that; watch it if you can. He makes a string of very good points about repetition, and more generally redundancy, in code.

  • At $former_employer, programmers had the nasty habit of copying and commenting out entire functions, entire classes even, to change a few lines of code. This was in a $language (not perl) that made it easy to do so...by commenting out the first line of an indented block, the whole block was commented. It made it hell to search for anything in the code. I wrote a perl utility to remove all such blocks before I started working on any such file. No one ever missed the code. And it was all in revision control (
    • ...should've said "by commenting out the line before an indented block".
    • It’s odd. For some strange reason, people Don’t Understand Source Control. And they have this inexplicable discomfort about deleting code.

      My impression is that this is a consequence of programming by coincidence, but I don’t know if that’s a sufficient (or even at all correct) explanation.