this post was submitted on 29 Mar 2024
966 points (98.3% liked)

Programmer Humor

19564 readers
576 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] magic_lobster_party@kbin.run 143 points 7 months ago (2 children)

Had a coworker who was a bit like this. They were tasked to do one simple thing. Required a few lines of code change at most.

They end up refactoring the entire damn thing and introduced new bugs in the process.

[–] something_random_tho@lemmy.world 86 points 7 months ago

I feel personally attacked.

[–] ripcord@lemmy.world 15 points 7 months ago (6 children)

Was there much value in the refactoring, like tech debt addressed?

[–] onlinepersona@programming.dev 56 points 7 months ago (3 children)

Doesn't matter. One concern per PR. Refactoring and tech debt are separate concerns.

CC BY-NC-SA 4.0

[–] Jesus_666@feddit.de 26 points 7 months ago (1 children)

Or, if the team does allow refactoring as part of an unrelated PR, have clean commits that allow me to review what you did in logical steps.

If that's not how you worked on the change than you either rewrite the history to make it look like you did or you'll have to start over.

load more comments (1 replies)
[–] nick@campfyre.nickwebster.dev 8 points 7 months ago (4 children)

You should refactor as needed as you go because refactoring cases are never gonna be prioritised.

load more comments (4 replies)
load more comments (1 replies)
[–] magic_lobster_party@kbin.run 6 points 7 months ago

A tiny bit of value, but definitely not worth the pain and effort. It wasn’t exactly any technical debt that hindered our development.

We had other places with way more pressing technical debt that could’ve been focused on instead.

load more comments (4 replies)
[–] morgunkorn@discuss.tchncs.de 111 points 7 months ago (4 children)
[–] magic_lobster_party@kbin.run 53 points 7 months ago (1 children)
[–] Restaldt@lemm.ee 6 points 7 months ago

Real men test in prod

Reaaal men of geeenius

[–] __init__@programming.dev 25 points 7 months ago

🚢🚢🚢

[–] humbletightband@lemmy.dbzer0.com 18 points 7 months ago

Lol go try merge

[–] keksbaecker@lemmy.world 13 points 7 months ago (2 children)

This response is so true and so sad.

[–] RustyNova@lemmy.world 11 points 7 months ago

[Open]

"LTGM!"

  • Last update a year ago
[–] OpenStars@startrek.website 9 points 7 months ago

Better than "rejected - git gud"? :-P

[–] sunbytes@lemmy.world 102 points 7 months ago (3 children)

sets the diff to ignore whitespace

Lines changed: 3

[–] kamen@lemmy.world 34 points 7 months ago (5 children)

The pipeline should handle formatting. No matter how you screw it up, once you commit, it gets formatted to an agreed upon standard.

[–] Flipper@feddit.de 16 points 7 months ago (2 children)

Or auto rejected when the format doesn't fit.

[–] FizzyOrange@programming.dev 7 points 7 months ago (6 children)

Yeah I think that's what he meant. You don't want CI editing commits.

I use pre-commit for this. It's pretty decent. The major flaws I've found with it:

  • Each linter has to be in its own repo (for most linter types). So it's not really usable for project-specific lints.

  • Doesn't really work with e.g. pyright or pylint unless you use no third party dependencies because you need a venv set up with your dependencies installed and pre-commit (fairly reasonably) doesn't take care of that.

Overall it's good, with some flaws, but there's nothing better available so you should definitely use it.

load more comments (6 replies)
load more comments (4 replies)
load more comments (2 replies)
[–] bleistift2@feddit.de 69 points 7 months ago (2 children)

That’s when you set the intern’s IDE to preserve the line endings.

[–] shotgun_crab@lemmy.world 22 points 7 months ago* (last edited 7 months ago)

.gitattributes is our best friend

[–] coloredgrayscale@programming.dev 8 points 7 months ago* (last edited 7 months ago)

Automatic code formatter with company style rules for more consistency across all developers.

[–] jjjalljs@ttrpg.network 67 points 7 months ago (6 children)

There was a guy I worked with that tended to want to unilaterally make sweeping changes.

Like, "we need the user to be able to enter their location" -> "cool. Done. I also switched the dependency manager from pip to poetry".

Only a little bit of exaggeration

[–] remotelove@lemmy.ca 29 points 7 months ago (7 children)

Some people, like me, are not built to be developers. I can sculpt code in any language I need for whatever problem I need to solve, but maintaining code over a long period of time, with others, is not my thing.

The drive to do additional changes is just too high and the tendency for typos or obvious logic errors is too common. (There is one little improvement. It's right there. One line up. Just change it now while you are in there....)

I am not stupid and regard myself as a decent engineer but my brain is just wired in a more chaotic way. For some things that is ok. For developing code on a team, not so much.

Security is the field I am most comfortable with because it allows for creative chaos. Rule breaking is encouraged. "Scripting" is much more applicable and temporary.

[–] coloredgrayscale@programming.dev 12 points 7 months ago (1 children)

Make those changes in an own commit, or keep it to files you already have to touch.

load more comments (1 replies)
[–] Faresh@lemmy.ml 9 points 7 months ago (1 children)

When using git and are working on a feature, and suddenly want to work on something else, you can use git stash so git remembers your changes and is able to restore them when you are done. There is also git add -p this allows you to stage only certain lines of a file, this allows you to keep commits to a single feature if you already did another change that you didn't commit (this is kind of error prone, since you have to make sure that the commit includes exactly the things that you want it to include, so this solution should be avoided). But the easiest way is when you get the feeling that you have completed a certain task towards your goal and that you can move on to another task, to commit. But if you fail you can also change the history in git, so if you haven't pushed yet, you can move the commits around or, if you really need to, edit past commits and break them into multiple.

[–] howrar@lemmy.ca 8 points 7 months ago (1 children)

Instructions unclear. Stash is 35 tall and I'm scared to look at what's been fermenting at the bottom.

load more comments (1 replies)
[–] UckyBon@lemmy.world 7 points 7 months ago (1 children)
[–] remotelove@lemmy.ca 7 points 7 months ago* (last edited 7 months ago) (2 children)

I do. Also, I am old(ish) so I have had many years to come to terms with what I can do well and where I struggle.

In this case, I didn't want to use it as a crutch or an excuse. After reading the number of awesome replies this morning, I realized I should have probably framed my comment differently.

People here put some real time and effort into giving some solid advice and I didn't expect that.

Edit: As a pure example, this is the third or fourth edit of this comment. Words are challenging, and programming is very similar in that regard.

load more comments (2 replies)
[–] avidamoeba@lemmy.ca 6 points 7 months ago* (last edited 7 months ago) (1 children)

I tell my young developers - the primary goal in software engineering is maintainability. Code reuse, encapsulation, abstraction, and myriad other concepts all contribute to ease of maintaining source code over the long term. Maintainability allows for easier, predictable feature addition and removal, with fewer changes, and by different people. You're also a different person than the one you were months or years ago when it comes to software.

load more comments (1 replies)
load more comments (3 replies)
load more comments (5 replies)
[–] SpaceNoodle@lemmy.world 38 points 7 months ago (2 children)

As long as there's less code than there was before, I'll approve it

[–] scarilog@lemmy.world 15 points 7 months ago (1 children)

Deletes codebase

Looks about right, approved ✅

[–] SpaceNoodle@lemmy.world 19 points 7 months ago (1 children)
load more comments (1 replies)
load more comments (1 replies)
[–] AnarchoSnowPlow@midwest.social 26 points 7 months ago (1 children)

Last time somebody did this to me there were a lot of sit downs about how to properly chop up large scale code changes and why we don't sit on our own branch for two months.

"How long will this take to get in?"

"Well, two weeks for me to initially review it, a week for you to address all the changes, then another week or so for me to re-review it... Then of course we have to merge in all the changes that have been happening in primary..."

load more comments (1 replies)
[–] ted@sh.itjust.works 24 points 7 months ago (1 children)

At least there are more removals than additions.

[–] prettybunnys@sh.itjust.works 77 points 7 months ago

Jokes on you that’s just the README being deleted since it no longer matches the code.

[–] ResoluteCatnap@lemmy.ml 19 points 7 months ago

My team lead: "I'll 🙈 review"

[–] swordsmanluke@programming.dev 14 points 7 months ago (2 children)

Net removal of 1500 LoC...

I'm gonna make you break this up into multiple PRs before reviewing, but honestly, if your refactoring reduced the surface area by 20% I'm a happy man.

load more comments (2 replies)
[–] KillingTimeItself@lemmy.dbzer0.com 12 points 7 months ago
[–] JATtho@sopuli.xyz 12 points 7 months ago

Please, no, I get flashbacks from my 6-month journey (still ongoing...) of the code review process I caused/did. Keeping PR scope contained and small is hard.

From this experience, I wish GitLab had a "Draft of Draft" to tell the reviewer what the quality of the pushed code is at: "NAK", "It maybe compiles", "The logic is broken" and "Missing 50% of the code", "This should be split into N PRs". This would allow openly co-develop, discuss, and steer the design, before moving to nitpicking on the naming, formatting, and/or documentation details of the code, which is likely to drastically change. Drafts do work for this, but the discussions can get uncomfortably long and convolute the actual finishing of the review process.

Once both reviewer(s) and the author agree on the code design, the "DraftDraft" could be collapsed into a link in an normal Draft to be mocked next. The scope of such draft would be limited by the earlier "DraftDraft".

[–] tatterdemalion@programming.dev 10 points 7 months ago (6 children)

This does seem like a potential issue if the PR is itself implementing more than one vertical slice of a feature. Then it could have been smaller and there might be wasted effort.

If the patches are small and well-organized then this isn't necessarily a bad thing. It will take more than one day to review it, but it clearly took much more time to write it.

load more comments (6 replies)
[–] Olgratin_Magmatoe@lemmy.world 8 points 7 months ago* (last edited 7 months ago)

My first PR at my current job was about 130 files for the front-end, and about 70 for the backend. This hits close to home.

[–] dan@upvote.au 8 points 7 months ago (7 children)

I try to keep my changes under 300-350 lines. Seems like a good threshold.

I'm still annoyed that Github doesn't have good support for stacked diffs. It's still not possible to say that one PR depends on a different one, and still has no ability to review and land them as a stack.

load more comments (7 replies)
[–] Secret300@sh.itjust.works 8 points 7 months ago (1 children)
load more comments
view more: next ›