6
atheist
13h

Me (code review): this isn't good, sometimes it duplicates stuff. If you move it over here it won't be duplicated.

Dev: it's useful, it's not quite the same as that other thing, sometimes it's different

Me: If you move it over here it won't be duplicated.

Apparently instructions were unclear the first time...

Comments
  • 3
    I also forget how competent I am and how much flexibility that gives me in my job. One comment was genuinely "I'll ask my manager if they want me to spend time on that", whereas I'd just say fuck it we ball, I gon do the thing.
  • 2
    Haha, ask manager to spend time on that. Like if there's anything worse than duplicate / corrupt data. Kinda no-brainer. Sounds like someone that doesn't really work autonomous
  • 2
    Sometimes it is not the same thing.

    I once got health data from a few doctor places. A bunch of data. But I got it hashed. Basically, the idea was, we aren't telling you our patients' data, except if you already know them. Hash their data and see if you know them.

    For everything I got different hashing instructions.

    Like lowercase last name, trim the ends, md5, sha256.

    Some of those seemed randomly decided. And then, suddenly, some where identical. And I was like: "Should I use the same function?"

    Let's say address and first name suddenly had the same instructions. I was like, no way, I do two different methods. Sure, the methods were copy-pastes, because they did the same thing. But I cannot guarantee that I don't get an update in next week. And if someone else gets the update, they need to figure out that address and last name are independent.

    IDE screamed at me for duplications.
  • 2
    I try and reduce duplicates only if it makes sense. I will on occasion find code with embedded data that is different in each duplication. Most of the time I can create a data structure that will account for this so I can reduce code to one version. Sometimes you just can't. Sometimes its better to rewrite I think.

    My boss did tell me that reducing duplication doesn't make them money. I sort of get it, but at some point you have to clean the shit mess up. Otherwise you spend time changing things multiple times. Which doesn't make money either.
  • 1
    if it's written multiple times and someone thinks they're adding a feature to that part of the code they'll change it in one place and don't know it needs to be changed in 300

    for stable specs should always be a function somewhere that does the process like the specs otherwise things are going to get unwieldy if something needs to be changed

    then if somewhere is doing "something slightly different" then put an accessory function beside the first one and document it...

    the problem with enterprise code isn't the complexity of the code itself but not breaking the specs. everyone's mega-lazy and it's hard to keep them all on board and not have such "bugs"

    also when I did enterprise stuff we had no tests lol. boss said he wanted to charge the client more for that so we had no tests... for one of the biggest companies in Canada that churned millions of customers a day... no tests =]
Add Comment