16
eo2875
3y

So the juniors finished a feature and it's okay, it passed all tests.

Now I'm cleaning their code and... I opened up a whole file with trash code that is either repetitive, or not even used. I decided to save it in case it breaks one of the features but... nope, everything seems to be running perfectly with just half of the code they wrote.

Comments
  • 3
    I can relate to that .... most of the time I see loads of duplicate code (like typescript interface definitions) and I always wonder how the hell someone could forget that they are writing the same code again and again ...
  • 1
    Unused declarations... and conditions without assertions

    They were trying to do:

    if( value == other_value ){

    raise Exception

    }

    but they just wrote:

    value == other_value

    They didn't even assign it to another variable... ugh
  • 2
    Most coders are more craftsman than developer.
    They are fine with writing extremely similar code thousands of times. They also never rant about boilerplate code or write an algorithm or lib.

    When you get them to their maximum level, where they actually do reduce duplicates into functions, they are pretty good at getting the boring parts of an application fleshed out quickly while still somewhat adhering to the DRY principle. They also tend to always create boring KIS code, which is easy (and boring) to review and maintain.
    The hard part is getting them there though...
  • 2
    Man... I've already been to 3 companies where the CTO kept making trash-level code like that. What's worse, all 3 of'em fought tooth & nail against their masterpiece getting refactored with moronic excuses like "it's tech debt" (my internal screams: "oh, so the code that you JUST wrote is tech debt now? brilliant!") or that their 4 duplicate blocks of code are "more readable that way" to which I actually responded "mofo, I just spent HALF AN HOUR trying to figure out why you copy/pasted this block in 4 different files instead of making it a function, how is that MORE readable?!"
    ...
    Anyway, at least you have a junior who isn't comfortable with DRY
Add Comment