11
Manuch
2y

This is what I have to deal with in my sad sad life

Comments
  • 3
  • 2
    wait, is this to find 29 Feb? wild
  • 2
    Write a unit test, delete this function, and build a proper one from scratch.

    That is all.
  • 2
    @fullstackclown this is a refactory I did about a year ago of a big ass function written by a guy who should be as far as possible from a computer.
    I left that line commented because I couldn't believe it
  • 1
    'And' has precedence, right? so not only are the years hard-coded but it doesn't even work for most of those?
  • 0
    Don't forget that every 400th year again isn't a leap year.
  • 2
    @localpost that line was going to break after 2032 so no worries
  • 2
    Non-English names and comments - yep, that indeed is what madness looks like!
  • 3
    @Oktokolo the first comment, from this guy, "alla mejo proprio" can be translated to "at the bestzz" (with a couple of random Zs)
    My comment next to it "revisione ... Perché..." means "revision ... Why..."
  • 2
    @Manuch You shall cleanse the code (and everything it touched) with fire...
  • 2
    @Oktokolo I had to, the only reason I had to do this refactory is that this program, instead of writing one row in a table per month, like it was supposed to do, it was doing something else.
    In a table where I expected about 20 rows (~ 2 years of usage) I found 45kk rows, that table alone was over 4GB.

    The guy before me did a series of horrible mistakes and everytime the user refreshed a list the program was adding about a 1k of records in this table and more shit somewhere else, for NO FUCKING REASON.

    It took me a month to refactor this garbage, having to fight myself to continue and finish it.
  • 0
    @Manuch 4GB for just 45k rows leads to an average row size of rougly 89kB. That is a lot for a non-BLOB record.
Add Comment