• 0 Posts
  • 50 Comments
Joined 1 year ago
cake
Cake day: July 3rd, 2023

help-circle


  • It’s strangely satisfying when the “this will probably never happen” test case finds a problem during development.

    I had tests for deleting that were like

    • create item a
    • create item b
    • delete item a via the code under test
    • assert item a is gone
    • assert item b is still there

    I thought maybe the whole bit with item b was excessive, but sure enough one day I accidentally fucked something up and deleted all the items, and the test pointed it out before the bad code left my local machine.





  • jjjalljs@ttrpg.networktoProgrammer Humor@programming.devNew language
    link
    fedilink
    arrow-up
    13
    arrow-down
    1
    ·
    3 months ago

    The python code we inherited had some performance issues. One of the guys was like “we should rewrite this in Java”.

    Luckily the boss was not an insane person and shut that down. The issue was an entirely stupid “…and then we do one query per project” behavior that worked fine when the company was small but unsurprisingly started to suck as users created more projects.

    Instead of a months long complete rewrite, we had a two hour “let’s add profiling… Oh wow that’s a lot of queries” session.



  • There’s two options in the green button on a pr. One is squash and merge, the other is squash and rebase.

    Squashing makes one commit out of many. You should IMO always do this when putting your work on a shared branch

    Rebase takes your commit(s) and sticks them on the end.

    Merge does something else I don’t understand as well, and makes a merge commit.

    Also there was an earthquake in NYC when I was writing this. We may have angered the gods.


  • …and? You squash so all your gross “isort” “forgot to commit this file” “WIP but I’m getting lunch” commits can be cleaned up into a single “Add endpoint to allow users to set their blah blah” comment with a nice extended description.

    You then rebase so you have a nice linear history with no weird merge commits hanging around.





  • I think it’s definitely a thing most people grow out of when they gain experience.

    My boss told me about how when he was new he rewrote a whole chunk of the front end. His boss gave him a talking to about how you can’t just go and do that when you’re working with a team.

    At an old job I just opened a PR to apply a code formatter to an internal project I wasn’t even a routine contributor to. PR was rejected and I learned a valuable lesson about talking and getting buy-in before making sweeping changes.




  • Did I already post in here about how he wrote a custom DSL instead of using the standard widely used ORM we use everywhere? Maintainability nightmare.

    He doesn’t work here anymore and now I have to either figure it out or rip it out. So far it looks like “rip it out” because it took less than an hour to swap in the orm, and now there’s just a lot less code needed.


  • It could be!

    But part of working as a professional on a team is communicating and achieving consensus. Just trying to make a change like that out of the blue is poor form.

    Also consider the opportunity cost: we had planned on getting XYZ done this week, and instead he spent a few hours on this and dragged a few people into a “do we want to change to poetry right now?” conversation


  • This guy was also difficult to argue with. He was always professional, which I guess is worth something.

    One time he tried to remove all the types from a bunch of code “because they were all going to change later.” I refused to allow this. We went back and forth in the comments for hours. I think eventually the lead or boss got involved. Thankfully people sided with me.

    His “later” project that was allegedly going to change all the things was rejected by the team. The code in question is still used and properly typed a year later.