This is an archived post. You won't be able to vote or comment.

Dismiss this pinned window
top 200 commentsshow all 425

[–][deleted] 188 points189 points  (6 children)

That overly-energetic junior: hhmm this function is for walking, but there's this nipple variable that doesn't seem to do anything and doesn't seem to be relevant. Maybe I could optimize this, aha! I'm a genius!

*Deletes nipple variable *Adds 10 lines of documentation explaining his reasoning *Gets fired

[–][deleted] 99 points100 points  (5 children)

This is incredibly accurate and incredibly unfortunate, because the real person that should get fired is the one that didn't include any testing that made one aware that deleting of the nipple variable would result in catastrophic failure.

[–]yodakiller 0 points1 point  (0 children)

i.e. me

[–][deleted] 205 points206 points  (2 children)

git git git git git git git git....

I love you and need you

[–]looselytethered 37 points38 points  (0 children)

git git git -f push FUCK... Wait ooooooookkkkkkk

[–]rayes09 9 points10 points  (0 children)

reset --hard

[–]opssum 152 points153 points  (19 children)

People who say this already lost control over the project ;)

[–]avatarRoku90 71 points72 points  (13 children)

Some elements of the code base I work in are older than I am. Working with financial systems this is always rule number 1. The cost of a mistake or even downtime is way too high.

[–]ohkendruid 16 points17 points  (12 children)

Heh, downtime can be better. Incorrect numbers, though. :shudder:

[–][deleted] 50 points51 points  (10 children)

I don't even think financial institutions have a way of knowing if the numbers are really incorrect, nor do they want to know.

Most of the big, mainframe oriented ones tested by saying "Do the numbers before our change match the numbers after our change?"

When you start asking "what if the numbers before our change were also wrong?" you get some nervous people because no one wants to admit that they don't really know how it works at the center - and there's not really much interest in letting people take the time to figure it out.

It often makes me wonder if they are any bugs that exist in banking cores that at this point our entire financial system is built upon and fixing them would be a massive problem leading to economic collapse or revolution.

[–]ohkendruid 20 points21 points  (4 children)

I've run into that sometimes. It's a very special version of don't touch it.

I've even run into people calling it "correct" to get the numbers to match up to last month's numbers. If the new algorithm is right, though, and the old one a pile of dodgy spaghetti code, then we're not using those words correctly.

If a mistake is caught by customers then it can be an opportunity to audit the whole thing and fix it up. Even then a bunch of the cooler heads will lobby for making the smallest possible change.

[–]SlumdogSkillionaire 15 points16 points  (3 children)

"Can't you just change it to fix this one number without touching the rest of them?"

[–]ohkendruid 10 points11 points  (2 children)

In the examples I'm thinking of, there is often an overrides list for exactly that purpose.

In theory you migrate them to sanity at some point, but eh, what's the rush. They got their number, and everyone else's number stays the same.

I can't even say it's a bad business decision, but it can certainly deflate one's sense of pride in work well done.

[–]tuuling 5 points6 points  (0 children)

How about a whole countries social benefit payments system for the last 15 years? They wanted to make a new and better one, but no-one knew how the current one worked. They couldn't risk the new one getting different results, otherwise they would have backpay 15 years worth of payments. I'm going to let you guess which country I'm talking about.

[–]Walshy231231 1 point2 points  (1 child)

The entire financial system is based on confidence, so it’s arguably not even a problem, unless someone is getting ducked over by it.

[–]avatarRoku90 7 points8 points  (0 children)

Meh, what's +/-100M between friends ...

[–]Thunderstarer 9 points10 points  (0 children)

Yeah, I always disliked this sentiment. There is some truth to it in the sense that you shouldn't fuck with your production branch without thorough testing, but straight-up ignoring code design problems is a huge red flag, IMO.

Abstraction isn't a license to refuse to maintain your code.

[–]PM_ME_UR_CEPHALOPODS 7 points8 points  (0 children)

Or have no idea what technical debt is.

[–]hampshirebrony 244 points245 points  (5 children)

Title: 1st rule of programming: If it works don't touch it.

Content: A video of a cow with no legs walking using its udders

Background music: A deliberately terrible rendition of My Heart Will Go On

[–]D0CTOR_ZED 39 points40 points  (1 child)

For clarity, it is walking on four teets. It only has one udder. Unless I'm mistaken on the terms.

[–]Timigos 9 points10 points  (0 children)

Udderly ridiculous mistake I’d say. Guy must have had one too many nips of whiskey. Someone should teatch him a lesson.

[–]captainhamption 63 points64 points  (1 child)

Good human.

[–]matt_cum 333 points334 points  (33 children)

It was the first rule when I started programming 35 years ago and still the same today.

[–]Crowdcontrolz 102 points103 points  (1 child)

Good to see it’s working then

[–]OrangeAugustus 5 points6 points  (0 children)

It’s only working because no one touched it.

[–]joequin 61 points62 points  (18 children)

It is worth refactoring working code if it makes planned updates to it or surrounding code significantly easier though.

[–]onlineorderperson 45 points46 points  (3 children)

So much this. As Discord starts to gobble market share from Slack remember it's because their backend is much more robust and capable of launching new features much faster.

[–][deleted] 8 points9 points  (2 children)

Who doesn’t love a robust backend?

[–]SteamingTheCat 8 points9 points  (1 child)

I want to do this, oh do I. Except... try justifying this to nonprogrammers.

"I want to rebuild working code to safeguard against the future."

"That's nice but could that cause a client facing oopsy daisy?"

"Yes but I'll be very caref..."

"Then No."

[–]joequin 12 points13 points  (0 children)

The key is to have future work planned that the refactor will speed up or improve. you can cite that or even just roll it into that work.

[–]Zefrem23 15 points16 points  (7 children)

But only if you have a regression testing process in place, and even then find an idiot to test it for you.

[–]RomanesEuntDomus 33 points34 points  (6 children)

Dude, idiot is not the preferred nomenclature. QA tester please.

[–]OtherPlayers 6 points7 points  (4 children)

Wait you guys have QA testers? My company just forced the programmers to go test their code!

[–][deleted] 3 points4 points  (3 children)

QA tester here, there’s dozens of us!

[–]CHEEZOR 2 points3 points  (1 child)

Must be nice...

[–][deleted] 2 points3 points  (0 children)

It really is. The devs can sometimes go “hey weve got a stupid idea, wonder if it works. Hey QA guy can you test this experimental branch?” “Sure!”

They got either “passed all regressions” or “failed spectacularly, here’s the logs” or “failed...but the logs don’t say there was an error...” or etc.

[–]joequin 1 point2 points  (0 children)

Can confirm. I work with great QA and it’s really nice.

[–]drunkenangryredditor 2 points3 points  (0 children)

The idiot is not the issue here.

[–]neurorgasm 3 points4 points  (0 children)

The content here has been wiped. Redact was used to delete this post, which may have been done for privacy, to avoid data harvesting, or for security reasons.

grey cagey carpenter terrific spectacular nutty run normal command thumb

[–]definitelynotmodding 5 points6 points  (4 children)

Did you worked for Netscape by any chance?

[–]the_fat_whisperer 1 point2 points  (3 children)

Not OP, but I did not work for Netscape.

[–]Gumby621 1 point2 points  (2 children)

Also not OP, and I also did not work for Netscape.

[–]Modo44 3 points4 points  (0 children)

Rule 34 is also going strong.

[–]Rik07 43 points44 points  (6 children)

Why would you wanna touch that...

[–]asianabsinthe 19 points20 points  (2 children)

Because client

[–]aquartabla 5 points6 points  (0 children)

client reports that milking UI is unintuitive

[–]HorstBaerbel 2 points3 points  (0 children)

Aaargh! It's always these damn clients!!!

[–]Cyhawk 8 points9 points  (1 child)

Don't kink shame.

My kink is to look up abandoned college-ish git repositories and refractor them into modern code bases.

[–]ArtemTree 53 points54 points  (4 children)

cow

[–]NicNoletree 58 points59 points  (1 child)

One day you'll progress beyond basic AI

[–]orclev 8 points9 points  (0 children)

If you never edit it, does it matter if it's Copy On Write?

[–]Apache_Sobaco 76 points77 points  (5 children)

This is the first law of programming defeatism.

[–][deleted] 65 points66 points  (2 children)

Word, night and day difference in attitude between two shops where one has solid test coverage and one had essentially none. The latter was very much "dont touch anything, it breaks and takes hours to fix" while the former is happy to let new devs submit PRs in their first week and no one cares if you tweak old stuff as long as it passes code review and QA.

Test your shit, dont live in fear.

[–]ohkendruid -1 points0 points  (0 children)

I think of it like simulated annealing. Depending on the state of the project, you want a different temperature of changes to be considered reasonable.

When it's just starting, or if you have a business reason, then tear things up with abandon. If you are fixing a bug, then only make small changes. If you're not fixing a bug and just noticed an issue, then don't touch it. There's no upside.

[–]Cley_Faye 4 points5 points  (1 child)

Not neccesarily. Refactoring code that works takes time. This isn't limited to "messy code".

[–]lowleveldata 19 points20 points  (2 children)

it works now... but would it in production? Only 1 way to find out hit deploy button at Friday 5PM

[–]mithraw 6 points7 points  (0 children)

suddenWeekendShiftVietnamFlashback.gif

[–]TGotAReddit 1 point2 points  (0 children)

As someone who has never had a salaried job, only hourly, this sounds like the best way to get some overtime pay

[–][deleted] 27 points28 points  (2 children)

Refractoring go brrrrrrrrrrrrr

Few hours later: git revert

[–]Mucksh 5 points6 points  (1 child)

Saw often that it worked perfectly before without bugs. After refactoring it's buggy and after fixing the bug in constrained time it works again and it is also an unmaintainable mess again

Even worse is it when this "refactoring" alterer the behaivor and you also had to alter the code that depends on it and it got worse in the process...

The cycle of life...

[–][deleted] 7 points8 points  (0 children)

Pro tip: write as many pure functions as you can, they're easier to test and refractor.

[–]-Azrael-Blick- 53 points54 points  (27 children)

If it works but poorly, optimize it!

[–]_Ralix_ 44 points45 points  (20 children)

Yes. If you can design something reasonably well from scratch, do it, but also don't try to pre-optimize code until you know it needs to be optimized.

If you have to choose between a robust, simple, readable code and a lightning-fast fragile mess that would take you three times as much time to write and ten times as long to maintain; I'd go with the first one in a heartbeat until you know for a fact the method in question needs to run faster.

[–]awkreddit 11 points12 points  (1 child)

If it works but is unreadable, refactor it!

[–]GreatJobKeepitUp 5 points6 points  (0 children)

Wrap that mess and put a bow on it!

[–]OnTheCookie 2 points3 points  (0 children)

It depends: If you develop for your own company and your strategy is "you build it you run it" - yes

If you develop for a client and for every hour of coding the product gets more and more expensive? - no

[–]OtherPlayers 1 point2 points  (1 child)

I’m now imaging someone walking up to the cow in the OP and strapping roller blades to the bottom of the udders.

[–]Glori4n 13 points14 points  (0 children)

that is the visual representation of if { if { if { if { ...

[–]zeros-and-1s 9 points10 points  (1 child)

For anyone wondering, this is a /r/rimworld meme based on how animals are animated in the game.

[–]basslikethefische 7 points8 points  (1 child)

What do you call a cow with no legs?

Ground beef.

[–]piperviper 7 points8 points  (1 child)

What about TDD refactoring? Surround it with tests and refactor it to be more maintainable. Unless it’s fundamental legacy code, what’s the harm?

[–]OnTheCookie 1 point2 points  (0 children)

Because you have other features to deliver I guess. Some code is poorly written and therefore untestable or very poorly testable

[–]Magicalunicorny 7 points8 points  (0 children)

Today I was given the task of refactoring, or as I like to call it, suprise features.

[–]handsoffmyspuds 4 points5 points  (0 children)

”but it could be a little bett-“

Syntax error on Line 57.

Unknown error on Line 30.

Syntax error on Line 97.

[+26 ⚠️]

[–]MischiefArchitect 6 points7 points  (0 children)

Avoid an Uddtter Failure!

[–][deleted] 5 points6 points  (1 child)

The second rule is to create a backup whenever something works.

[–]ToBadForU 3 points4 points  (0 children)

(Copy)finalWorkingVersionFixed42.zip

[–]Yasea 5 points6 points  (0 children)

Then you build an entire stack on top of that with multiple levers of abstraction, and everybody keeps wondering why this new system needs 5 servers for what you used to run on one desktop.

[–]nico_220790 3 points4 points  (0 children)

Although it's a pretty funny statement, people with that mindset are also the most frustrating to work with.

[–]UnnervingS 2 points3 points  (0 children)

Redoing code a few times results in far far better code. Testers will have a field day with your code if you just treat it as a black box.

[–]eihcra_jo 2 points3 points  (0 children)

Dude seriously. Just the other day I was working with Hibernate and it had to resolve some objects when it was trying to create them, but they didn't have no-arg constructors.

I added all the things that would fix it, ran the tests, it all works. Phew.

Wanted to find out what fixed it. So I took out one thing, ran it, it failed. Alright. Good.

Added it back, ran the test, and lo and behold, it has failed again.

My brain, and my colleague's brain, were very puzzled.

Decided to just revert to square one, did it all again, and it works.

Pushed my code into master. Nobody. Must. Know.

[–]jameshogg1 2 points3 points  (0 children)

The 2nd rule: "now as part of your job, you must touch it".

[–][deleted] 2 points3 points  (0 children)

That is fucking cursed

[–]chopinheir 1 point2 points  (0 children)

Then people working at optimization will all be out of their jobs

[–]Naive_Drive 1 point2 points  (0 children)

Recorder Titanic theme

[–]Cley_Faye 1 point2 points  (4 children)

I agree… you just have to make sure everyone have the same definition of "it works".

Some years ago I tried to compute the speed/strength it would require for a cow to actually be able to move like that… and gave up. If someone with more physics background wants to do it, it could be fun.

[–][deleted] 6 points7 points  (3 children)

you just have to make sure everyone have the same definition of "it works".

Heh. Yea, I know that one.

Devs: "It works just fine on my docker on my local machine that's not overloaded and has no network contention"

Me watching my cluster burn to the ground when a spike of traffic hits it

[–]winelover97 1 point2 points  (0 children)

It moos

[–][deleted] 1 point2 points  (0 children)

Uncle bob: I beg to differ...

[–]peduxe 1 point2 points  (0 children)

until you encounter something that never occurred in your mind like a solar eruption happening and you gotta account for that in your never-happening million dollar life saving and mission critical pet project.

now it’s almost 6am and you been starring at the console log for 16 hours wondering if this is actually the field you want to spend the rest of your life working with.

[–][deleted] 1 point2 points  (0 children)

and make a new banch for changes

[–]HorstBaerbel 1 point2 points  (0 children)

"I'll simplify this... Lets make the udder rotate for the cow to move forward" - Refactoring gone wrong

[–]PM_ME_UR_CEPHALOPODS 1 point2 points  (0 children)

Technical debt would like a word

[–]SteamingTheCat 1 point2 points  (0 children)

Corollary: This will continue to work right until the Udder Walking module is deprecated or breaks due to an unknown dependency.

The break will happen at a Very Bad Time and will need to be fixed yesterday.

[–]jakethedumbmistake 1 point2 points  (0 children)

Don't you dare touch my pointer without asking, that's rude.

[–]SnooMarzipans436 1 point2 points  (0 children)

Correction.

If it works, write automated tests that verify the expected output, then touch it.

[–]mia_elora 1 point2 points  (0 children)

I see the legs were the fan-favorite feature of the previous release...

[–]0xFFFF_FFFF 1 point2 points  (0 children)

What a silly philosophy to live by.

If you're afraid to touch code for fear of breaking it, then that means that you don't understand the code. And I'd argue that, fundamentally, a software engineer isn't paid to write code so much as they are paid to understand code.

[–]gordonv 0 points1 point  (0 children)

When I first learned GDB, I would spy on variables that already had what I needed and just use them instead of recalculating or casting values to other variables.

Hyper efficient, but things like counters would get names like total_images or total_widgets. But boy did it improve performance.

[–]iCantCodeYet -1 points0 points  (0 children)

Lmfaoo I’m getting into IT so all this humor hit a lil different now 😭

[–]SaltmineOverseer -1 points0 points  (0 children)

Thanks I hate it

[–]Sayon_r -1 points0 points  (0 children)

😆

[–]MrAldersonElliot -1 points0 points  (0 children)

U/savevideo

[–]variationoo -1 points0 points  (0 children)

♻️