• Moops@lemmy.world
      link
      fedilink
      English
      arrow-up
      18
      ·
      edit-2
      6 months ago

      I mean, runtimes can be a legit reason to say something’s not working.

      • pearsaltchocolatebar@discuss.online
        link
        fedilink
        arrow-up
        13
        ·
        6 months ago

        But it does work. Eventually.

        Really, I fixed it because we’re doing an OS upgrade and I didn’t want to wait 2h every time I spun up a new instance to test a change.

      • FiskFisk33@startrek.website
        link
        fedilink
        arrow-up
        1
        ·
        6 months ago

        that’s the problem with the ‘its working’ argument.

        if you hadn’t touched the working code you might have missed the performance issue to begin with.

  • lobut@lemmy.ca
    link
    fedilink
    arrow-up
    20
    ·
    6 months ago

    Well over a decade ago I remember a coworker would just go through the codebase and add his own coding style.

    Instead of if (predicate) {

    He would do if ( predicate )

    I would always ask why he did it and he said, “well we don’t have any coding standards so I’m going to do it” … I replied, “there’s things like unwritten rules and sticking to whatever’s in the codebase makes it easy”. I told the seniors and they chose not to do anything (everyone just merged into trunk) and they just left him for a while.

    Then he turned rewrote built-in logical functions in code like this: if (predicate || predicate) {

    Into code like this: if ( or( predicate, predicate ) ) {

    This was C# and there was no Prettier back then.

    Also, he would private every constructor and then create a static factory method.

    Eventually the seniors told him to knock it off. All I said was that I initially tried telling them weeks ahead of time and now we got a mess on our hands.

    • Electric@lemmy.world
      link
      fedilink
      arrow-up
      18
      arrow-down
      1
      ·
      6 months ago

      Hilarious but their fault for not making a standard. The guy was just taking the initiative.

      • jjjalljs@ttrpg.network
        link
        fedilink
        arrow-up
        5
        ·
        edit-2
        6 months ago

        The correct initiative would have been to make a coding standard and get buy-in, not yolo unilaterally enforce your own idiosyncrasies.

    • SavvyWolf@pawb.social
      link
      fedilink
      English
      arrow-up
      9
      ·
      6 months ago

      The best part is that his “or” function changes the semantics of the code in a subtle and hard to find way. :D

    • jjjalljs@ttrpg.network
      link
      fedilink
      arrow-up
      4
      ·
      6 months ago

      We have one of those situations at work. We’re a small team, but one guy is kind of unilateral in his work style. He added a bunch of “interfaces” and “domain” modules in our python Django app. His idea seems to be like instead of doing Project.object.get(id=1) with the standard Django library, you’d do like import project_interface; project_interface.get_project(id=1). The “interface” then does some home grown stuff, and probably delegates to the Django library eventually. All of which to me seems unnecessary, “yo dawg” redundant, and error prone.

      Also in some places he’s returning like a dict instead of query set or other Django object, which is going to cause problems later.

      All of those specifics aside, because I’m sure he has reasons for all of this, but it’s annoying that he’s been doing it unilaterally. Worse, he had a project proposal to make the entire codebase like this and it was shot down. And every time it comes up in code reviews he’s like “well, I think this is good and we don’t have a standard saying otherwise”.

      I started really putting my foot down in places I have clear code ownership, but it still turns into like 30 comment exchanges on the pr.

      He also has his own import sorting. Which could be fine except he never shared it or put it in the ci pipeline. So no one agreed to sort and comment imports like this, it’s only in files he touched, and when other people change imports the comments become lies.

      We have a standards meeting next week and I am not looking forward to it. We’ve been friendly for years and worked together before, but somehow at this job it’s just not a smooth time.

  • haruki@programming.dev
    link
    fedilink
    arrow-up
    19
    ·
    6 months ago

    This is actually not a good advice, from my experience. If we don’t monitor, refactor, or improve the code, the software will rot, sooner or later. “Don’t touch” doesn’t mean we don’t ever think about the code, but we make the conscious choice not to modify it.

  • Vlyn@lemmy.zip
    link
    fedilink
    English
    arrow-up
    16
    ·
    6 months ago

    Yeah, I’ve worked with the leave it alone types. What do you get in return? Components of your system which haven’t been updated in the last 20 years and still run .NET 3.5. They obviously never stopped working, but you have security concerns, worse performance (didn’t matter much in that case) and when you actually need to touch them you’re fucked.

    Why? Because updating takes a lot of time (as things break with every major revision) and on top of that if you then decide not to update (yeah, same coworker…) then you have to code around age old standards and run into bugs that you can’t even find on Stack Overflow, because people didn’t have to solve those in the last 20 years.

  • wabafee@lemm.ee
    link
    fedilink
    arrow-up
    14
    ·
    edit-2
    6 months ago

    Or you do the right thing re-write or refactor, apply the latest practice add some tests to it. This way you won’t have a black box anymore. Who knows there might be a hidden bug there that might be a huge security issue and could bite you back in the future.

  • jjjalljs@ttrpg.network
    link
    fedilink
    arrow-up
    11
    ·
    6 months ago

    I was mildly annoyed the other day when someone moved a works-fine function and reimplemented it with dropwhile. This apparently was a divisive idea.

    Me: it worked fine. Don’t reimplement it for no gains. Don’t send people to somewhat esoteric parts of the standard library. No one on this team is going to know how that function works off the top of their head.

    Them: it’s in the standard library it’s fair game. It still works.

    • magic_lobster_party@kbin.social
      cake
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      6 months ago

      One benefit of using dropwhile is that (with a bit of practice) it can actually be easier to read than a for loop. All for loops look similar. You need to read the for loop line by line to understand what it really do.

      With dropwhile (or map, filter and reduce), it’s immediately obvious it will drop all elements until a certain condition turns false.

        • Kogasa@programming.dev
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          edit-2
          6 months ago

          Skip. As in, “drop the first 5 elements of this iterable.” dropwhile is “drop each element until the given predicate is satisfied.” It’s really not that obscure, I dunno what the original commenter is on about

          • Doc Avid Mornington@midwest.social
            link
            fedilink
            English
            arrow-up
            1
            ·
            6 months ago

            Yeah, I’m not even a python dev, I knew what dropwhile did immediately from the name. Some people just don’t want to learn anything new, ever.

  • tsonfeir@lemm.ee
    link
    fedilink
    arrow-up
    7
    ·
    6 months ago

    I’m a big fan or refactoring and rewriting my code as often as I can. Not only does it keep my brain “on topic” but it allows me to make major improvements. Nothing will ever be perfect. Just try to leave it in a better state than it was before.

  • kamen@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    ·
    6 months ago

    No, we must rewrite it in this fancy new framework that came out last week.

    (/s if not obvious)