10

So today I started working on a code base someone else wrote and stubled across this and thought it was worth sharing.

Why somebody would be doing something like this is beyond my understanding.

Not commenting on the empty catch block keep in mind the whole snippet has nothing to do with rest of the code...

WHY!!!!!?!?!?!?!

Comments
  • 5
    My guess: wanted to check the hash function worked in this scope, never got around to properly removing it, and after forgetting about it, kept it in case it had a side effect that magically let's the program run that would be destroyed if the call were to be removed
  • 3
    @CptFox How silly of me? How can I forget the basis of programming?

    Never delete pieces of code even they're not needed anymore :)
  • 2
    @PsCustomObject You may comment it out for a test period of 3 months before actually deleting it, even through you have git, comments are safer. It is known.
  • 1
    @CptFox GIT? What is it? I forgot to mention all the changes to the code I posted were performed on a production server... directly in the script code without notifying anybody.

    Well it is just a script handling automation of users provisioning in our LDAP infrastructure so nothing important :-/
  • 0
    @PsCustomObject so sounds like someone was troubleshooting an issue on a production server, must have been pretty desperate
  • 0
    @Plasticnova err not sure how to say this.. but err... was not troubleshooting for this person this is the standard way of ‘developing code the DevOps way’ his words not mine.
  • 0
    @PsCustomObject This way of programming and the fact that this is PHP makes me all the more suspicious that:
    a) This project may have been implemented using the SEOP Paradigm: Side-Effect Oriented Programming.
    b) The Dev in question may be particularly used to this paradigm, making him especially weary of deleting or moving code that doesn't seem to be relevant where it is.
  • 1
    @CptFox it is Powershell :-)

    And yes person question is used to do a lot of copy/paste/never delete with little or no care
  • 1
    @PsCustomObject my condolences, that sounds like a nightmare
  • 1
    @Plasticnova thanks and.. it is.

    On the bright side the guy will be no more in couple of days :-)
  • 1
    @JustThat Because of reasons. Do not question the comments, fool. You might anger the code 👻
  • 0
    @CptFox ahahah this indeed my day (well evening :-))
  • 0
    50 cents!
Add Comment