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

Programmer Humor

19452 readers
131 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
[–] [email protected] 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.

[–] [email protected] 86 points 7 months ago

I feel personally attacked.

[–] [email protected] 15 points 7 months ago (6 children)

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

[–] [email protected] 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

[–] [email protected] 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)
[–] [email protected] 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)
[–] [email protected] 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)
[–] [email protected] 111 points 7 months ago (4 children)
[–] [email protected] 53 points 7 months ago (1 children)
[–] [email protected] 6 points 7 months ago

Real men test in prod

Reaaal men of geeenius

[–] [email protected] 25 points 7 months ago

🚢🚢🚢

[–] [email protected] 18 points 7 months ago

Lol go try merge

[–] [email protected] 13 points 7 months ago (2 children)

This response is so true and so sad.

[–] [email protected] 11 points 7 months ago

[Open]

"LTGM!"

  • Last update a year ago
[–] [email protected] 9 points 7 months ago

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

[–] [email protected] 102 points 7 months ago (3 children)

sets the diff to ignore whitespace

Lines changed: 3

[–] [email protected] 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.

[–] [email protected] 16 points 7 months ago (2 children)

Or auto rejected when the format doesn't fit.

[–] [email protected] 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 (1 replies)
load more comments (4 replies)
load more comments (2 replies)
[–] [email protected] 69 points 7 months ago (2 children)

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

[–] [email protected] 22 points 7 months ago* (last edited 7 months ago)

.gitattributes is our best friend

[–] [email protected] 8 points 7 months ago* (last edited 7 months ago)

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

[–] [email protected] 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

[–] [email protected] 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.

[–] [email protected] 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)
[–] [email protected] 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.

[–] [email protected] 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)
[–] [email protected] 6 points 7 months ago (1 children)
[–] [email protected] 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)
[–] [email protected] 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)
[–] [email protected] 38 points 7 months ago (2 children)

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

[–] [email protected] 15 points 7 months ago (1 children)

Deletes codebase

Looks about right, approved ✅

[–] [email protected] 19 points 7 months ago (1 children)
load more comments (1 replies)
load more comments (1 replies)
[–] [email protected] 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)
[–] [email protected] 24 points 7 months ago (1 children)

At least there are more removals than additions.

[–] [email protected] 77 points 7 months ago

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

[–] [email protected] 19 points 7 months ago

My team lead: "I'll 🙈 review"

[–] [email protected] 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)
[–] [email protected] 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".

[–] [email protected] 12 points 7 months ago
[–] [email protected] 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)
[–] [email protected] 8 points 7 months ago (1 children)
[–] [email protected] 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.

[–] [email protected] 8 points 7 months ago (1 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.

[–] [email protected] 6 points 7 months ago (6 children)

How is this different from creating a feature branch and making your PR against them until everything is done, then merging that into the main branch?

load more comments (6 replies)
load more comments
view more: next ›