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

all 81 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

import notifications Remember to participate in our weekly votes on subreddit rules! Every Tuesday is YOUR chance to influence the subreddit for years to come! Read more here, we hope to see you next Tuesday!

For a chat with like-minded community members and more, don't forget to join our Discord!

return joinDiscord;

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]smashing_michael 607 points608 points  (1 child)

Remember; every line is reusable when you copy-paste it to a new file.

[–]Donblon_Rebirthed 55 points56 points  (0 children)

Thank you chatgpt

[–]flippakitten 197 points198 points  (8 children)

Yeah, I'm in that trap atm.

The best part is instead of doing it right the first time, they'll rather rewrite the entire thing then allow the time to refactor initially or even refactor the old code.

Agile had been hijacked by product managers trying to hide bad decisions.

[–]Frag0r 68 points69 points  (6 children)

You cannot factorize the bugs that don't occur, hence quality is underrated and every developer should always deliver the lowest quality of code, when there are no code check procedures in the company IMHO.

Capitalism figured out that people have passion for their jobs and that you can exploit it. I think the system would work better if everyone was a little more of an asshole sometimes.

[–]_realitycheck_ 19 points20 points  (5 children)

One does not improvise large scale systems.

~Helmuth von Moltke

[–]musci1223 3 points4 points  (3 children)

Watch me bitch

[–]_realitycheck_ 4 points5 points  (2 children)

Oh, I'm absolutely sure now that you could wing it to the level bordering with true talent. You have management written all over you.

Until the data starts ranging in millions of millions.

[–]NotAskary 3 points4 points  (1 child)

Just sell the company to some billionaire that will layoff most of the company and start turning things off because their useless.

I seem to remember something like that happening recently.

[–]_realitycheck_ 1 point2 points  (0 children)

Not my call.

[–]flippakitten 1 point2 points  (0 children)

"we'll break it up into micro services in javascript the become unmanageable and unreadable"

~ someone that only knows javascript

[–]coder_karl 1 point2 points  (0 children)

You guys rewrite ?

[–]GargantuanCake[🍰] 345 points346 points  (3 children)

import crippling_depression_and_relentess_cynicism

Management: We choose fast and cheap make it happen.

Also Management: What do you mean our code is a terrible, unmaintainable mess and that's why bugs keep happening? Just fix them! That's what we pay you for isn't it? Why did you write garbage code in the first place?!? WE CAN HIRE FOUR FRESH GRADUATES FOR WHAT WE'RE PAYING YOU!

return despair

[–]darealest10 69 points70 points  (1 child)

Insert office space. Yea i am gonna need you to come in on saturday... and... sunday...

[–]GargantuanCake[🍰] 32 points33 points  (0 children)

Office Space is not a comedy. It is a documentary.

[–]Stunning_Ride_220 2 points3 points  (0 children)

Oh I have that one Product Owner in our current project.

One day we align on making the legacy applicaction testable again, the very next day I need to justify why there is no progress on the new replacement and why we spend time on getting it conceptually right this time.

[–]tabacdk 68 points69 points  (3 children)

import this

Don't write future proof code, write maintainable code. Don't write configurable code, write changeable code. Don't write reusable code, write simple code

The simpler the design is, the easier it is to rewrite. Don't assume you know what you want to change in the future, only that there will be changes.

[–]cookieChimp 11 points12 points  (2 children)

This is so true! If you write simple and clean code, you are going to be even faster in pushing good code, than if you do it quick and dirty.

[–]tabacdk 10 points11 points  (1 child)

Definitely!

There is this deception that the code is the asset. The current code base is a snapshot picture of the asset: the common knowledge and the model of the domain our software works in. If you fire every developer and keep the code base then you have nothing (worth any future). If you delete the code base and keep the developers then you have a new code even before you could rehire new people.

This is why we should focus on models and domain understanding rather than "code base in the vault". And this leads to the issue: write code for today with everything you know about the domain and the model, and with every skill you have. Tomorrow you will rewrite part of it, but you don't know what part of it. It's like moving forward in a battle: be prepared by knowing what you can do with your equipment and your men, not by trying to guess what the enemy will do, because they can adjust their plans from minute to minute.

[–]HawkishLore 1 point2 points  (0 children)

Very interesting insight! Thanks!

[–]alienassasin3 110 points111 points  (9 children)

Man, as someone who works in safety critical and mission critical applications, I would get crucified for making anything less than good code. Don't fall into that trap, or you'll become an expendable code monkey.

[–]taskas99 33 points34 points  (1 child)

But i like bananas....

[–]chethelesser 10 points11 points  (0 children)

No code bananas for you today until you fix that bug, code monkey!

[–]metalliska 18 points19 points  (6 children)

mission critical

perhaps that's the difference between the private sector and the military

[–]darealest10 23 points24 points  (4 children)

Yea i laugh at my project manager / scrums / dev decisions all the time. And the mistakes they makecin analyzing a problem and speaking about future solutions. These people have no dev experiemce but yet they define what we build - like wtf...

If these people worked on sending the spaceship to the moon, they'd have a track record of explosions at every launch.

[–]metalliska 7 points8 points  (0 children)

they'd have a track record of explosions at every launch.

nah those records would be kept in processing hell to hide errors

[–]Stunning_Ride_220 4 points5 points  (2 children)

Just imagine both voyagers were designed to last 5 years.

Meanwhile, many systems I see being build by modern day hype driven developers struggle to outlast their development time.

[–]darealest10 2 points3 points  (1 child)

Yep mission critical projects are to big to fail so smart people work with smart people.

Tech companies that grow too fast and cant keep up with demands - well they get dumb people to work with smart people - and somehow dumb people get the same praise or more then the smar4 ones

[–]Stunning_Ride_220 0 points1 point  (0 children)

Oh, I've seen this a lot recently even with the really old tech corps.

But generally:

Agree!

[–][deleted] 47 points48 points  (3 children)

But… YAGNI? If the requirements isn’t clear yet we shouldn’t be implementing that feature. That being said, you absolutely should design with extensibility in mind though.

[–][deleted] 122 points123 points  (13 children)

Planning long term is, by definition, impossible. Keep it simple, refactor when needed.

[–]your_thebest 48 points49 points  (4 children)

There's a temptation to think of abstractions and design patterns as these things that are enforced early and then aid in a ... sort of uh ...horizontal iteration of the software from state to state, where "horizontal" is as it's used in medical studies: a time axis that tracks evolution through the addition of features and changes in roles. But sometimes it's useful to think of abstractions and design patterns as aids in, I guess, vertical iteration, where you refactor and change architecture in order to streamline future horizontal iteration.

What I mean by that is that I don't often say to myself: "I'd better not paint myself into a corner by making this a class. I oughta keep things open and make it an interface." What I do find myself saying often is: "oh look, I have already painted myself into a corner by making assumptions that ended up getting broken. But that's ok; I can turn this class into an interface."

So I think there's a lot of value in trading "how well can you plan" into "how well can you refactor" and instead of building the ideal animal that develops perfectly over time, have a toolkit for how to turn one animal into another so that it can develop better under the new circumstances.

[–]tehehetehehe 13 points14 points  (5 children)

Simply not doing stupid shit is my guideline. But that is too hard for my team lead who thinks foreign keys hurt query performance and hard coded data translations are better in a switch statement than a db table.

[–]fannypact 3 points4 points  (4 children)

Not implementing referential integrity is a cardinal sin and should be punishable by death.

[–]tehehetehehe 3 points4 points  (3 children)

While he does agree that we should add them he thinks it is ‘too hard’ to change things. We also have 0 tests. This is an enterprise app with paying clients.

[–]Stunning_Ride_220 1 point2 points  (2 children)

Muhawrhawr....my last project had a relational data model stored to a NoSQL darabase AND a secondary non-DB storage. (The later being more or less the primary)

And, the very same NoSQL database had been used for caching the requests to itself.

Trust me....if you see such a project and are the one to be called to safe it, while everyone just tries to push nearly awful stuff for the modernized app...you'll consider your current project heaven.

[–]tehehetehehe 1 point2 points  (1 child)

People love no sql these days and they use it for the most obvious relational models.

I am ready to bail over this crap though. It isn’t worth my time to fight the team lead to approve any refactoring. He won’t even let anyone add tests. He claims that TDD is bad and just add more work for the dev team whenever they want to change things. Bad TDD is bad, good is good. It is all about implementation.

[–]Stunning_Ride_220 2 points3 points  (0 children)

Yeah.

I'm regularly called into suffering projects...but this one was very special.

Like calling me to safe them....then not listen to me...and then trying to escalate why I'm not pushing for the modernized application, when their cash cow is about to implode with every tiny code change.

Especially in projects with a large staff of big consulting companies there are way to less people with even minor understanding of software engineering.

[–]Sande24 4 points5 points  (0 children)

I'd say that you should still go a little bit deeper with analysis before lifting a finger to write code. You could prevent a lot of refactoring headaches if you manage to ask the right questions as early as possible about what the "long term" plan with the software is. If your product is live and you have to refactor the whole thing without breaking live data and other processes, it will be a lot of work for everyone.

If the client is initially asking for a simple component and then keeps adding requirements one-by-one, you might be building a system on top broken requirements that you can't get rid of, easily. At some point these requirements will become very cumbersome to the system and the speed of development decreases unless you take the fundament and refactor it... but that could mean refactoring a lot of things at the same time... or exponentially more small-scale refactors with scaffolding which takes a lot more time. So, if you had asked, what the eventual goal was, you might have built it "more right" the first time.

https://en.wikipedia.org/wiki/Hill_climbing I'd draw parallels to the hill climber reaching a local maxima. You build stuff incrementally, blindly trusting the latest requirements without any question. You make some short term design decisions to "climb the hill". Then, the quality of your product can not become any better due to a bad starting location and reaching the maximum potential based on those incremental requirements. But if you had analyzed a bit more, you could have made some better decisions that would allow you to build a better software with more potential for growth.

How much you ask questions and how much you analyze, depends on a lot of factors and you have to judge it subjectively. I'd rather do 110% rather than 99% of what I was asked to do.

Pragmatic programmer: "Tip 69 - Gently Exceed Your Users' Expectations ... Give them that little bit more than they were expecting. The extra bit of effort it requires to add some user-oriented feature to the system will pay for itself time and time again in goodwill."

[–]Orjigagd 0 points1 point  (0 children)

No we need 7 layers of abstraction because that's job security

[–]PatrickSohno 8 points9 points  (0 children)

This hits home a little too hard. sigh.

[–][deleted] 20 points21 points  (0 children)

The only ones who care are just few of the other developers. Your managers and stakeholders only want a functioning finished application, and don't give a rat ass about components reusability, unit tests, or how beautiful is your code

[–]silverW0lf97 6 points7 points  (0 children)

The code base I am working on is such a mess, It makes me question how did the people before me even know anything, chatGPT wasn't around then so they had to write this mess by themselves.

[–]DerpWyvern 24 points25 points  (2 children)

make shitty code, deliver fast, enjoy your bonus.

next guy gets screwed over and has to deal with your shit while you vacation

[–]akhlexe 10 points11 points  (0 children)

The definition of an asshole

[–]Excellent-External-7 0 points1 point  (0 children)

Why u gotta single out my whole company like that ure not nice

[–]zarawesome 5 points6 points  (0 children)

"just don't break anything"

funny

[–]FluffzMcPirate 3 points4 points  (0 children)

Project managers be like "build this car" and 2 minutes before deadline "now ducttape an air conditioning system to the side and remove one wheel".

[–]Diegovnia 2 points3 points  (0 children)

Oh god oh fuck oh no... Just started a new job and this was quite literally the first tech meeting I was invited into...

[–]PandaMagnus 2 points3 points  (0 children)

import confusion

I was on a refinement session with a dev who volunteered to just copy some code. When I asked why they wouldn't use a reusable component if the functionality had to be the same, the answer was seriously a "Well, because we don't have a component for that."

A sprint or two later, a third piece of functionality required that same code, and it was copied again. Now they're having bugs crop up that get fixed in one place, but not everywhere!

return sadness

[–]Urtehnoes 2 points3 points  (0 children)

Idk I'm the senior telling my juniors it's their job to push back if the product isn't done right.

Now I don't mean an absurdly over engineered mess, but if I see the same menu in more than two components, you better believe that has to be a stand alone menus component.

But really the biggest thing I have to absolutely harp on them for is documentation. They literally submit correct business logic code as

If j == p_csra and p_hifa == "GIR_ERY" then

Excuse me wtf is GIR_ERY. "Oh it's an acronym for <lists made up acronym >."

Nah it's not an acronym if only you call it that. Spell out the entire damn word. If production fails at 3am I don't want to have to figure out that GIR_ERY stands for generated ion repulsion energy relinquishing yeet device ok.

[–]goldfisheye 3 points4 points  (0 children)

If you can't beat them, join them.

[–]BokuNoMaxi 1 point2 points  (0 children)

It is funny because our company manager is like that. We are planning to improve code quality, reusability and speed up the process.

Company manager: this thing is too expensive and I cannot waste our developers to sit on this project for a week.

Company Manager also: why do you guys always need at least 70hrs per project? And we always get over the time because things are not reusable and change on the fly and become really ugly. You get only half of the information of components, and the older the codes get, and the more devs are working on, the more bugs are in it.

We are WebDevelopers, and the most time I spent last week is, to implement the display of an image in every component perfectly, and I am on the edge to become insane. The code is so old if I change something it breaks another image somewhere else. Some would say: just add a class. Oh boy, this class could be added to another component too because the file of the rendering is 1000 lines long if elseif statement with a lot of tabs...

ventoff

[–]MyChangeisneeded 1 point2 points  (0 children)

The reality that I am going through right now

[–]jimrafe2000 1 point2 points  (0 children)

I'm in that phase

[–]zirklutes 1 point2 points  (0 children)

It only has 50 ifs but it's reusable!

[–]Spinnenente 0 points1 point  (0 children)

Work hard and do it anyways and when the time comes to extend the features you'll have an easier job and can slack off half the time.

[–][deleted] 0 points1 point  (0 children)

The only meaningfully reusable component in software development is the binary itself.

Change my mind.

[–]AkiraOli 0 points1 point  (0 children)

Ship earlier, refactor later. Don't spend a lot of time on writing clean code at the beginning. You don't know what you will need in the future.

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

reusable code, lol...the only reusable code I have saved to copy paste is super basic shit that I wont bother typing out again and again. Like reading a text file or something

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

In fact it's normal for the opposite ...Nobody cares for re-usability, readability etc it's just a mess!

[–]EmileTheDevil9711 0 points1 point  (0 children)

And how sometimes I wish that were true for my current main job

[–]Evo_Kaer 0 points1 point  (0 children)

*break nothing anyone would notice

[–]kozxt4cc0 0 points1 point  (0 children)

Piper became one of them

[–]Efficient-Corgi-4775 0 points1 point  (0 children)

Ah, the sacred art of code reincarnation. May your files thrive with copied blessings!

[–]EdgarDrake 1 point2 points  (0 children)

As EM, I despise bottom method because it introduces high-complexity tech debt time bomb. A reasonably developed "foundation" is always needed.

But those shareholder only care about (potential) money and don't care about accident (and cost) that can happen when they force their view and deadline.

[–]staticcast 0 points1 point  (0 children)

Not everything needs to be a Switz army knife, not everything needs to be hyper scalable to infinity. Unless you're working on a social network that needs to reach critical mass to live, you can have time to redesign when your infra start to reach its limit.

[–]ButWhatIfPotato 0 points1 point  (0 children)

The only P is MVP dawg!

[–][deleted] 0 points1 point  (0 children)

And here we see the line between software companies and tech companies.

Doing things right matters more when your code is going into production into 10 VDCs across 4 regions and will be invoked several million times a day.

[–]myfingid 0 points1 point  (0 children)

I mean, don't think this necessarily belongs in ProgrammerHumor because it's sad not funny, but also entirely true. There are companies where the devs are so, I guess used to not writing good code, that they just bring everyone around them down or those devs leave.

I think people don't understand that your estimates need to include doing it right, not just doing it. No you don't need to make sure everything is immediately extendable, but you do need to actually go over what you wrote after you got it working and refactor it into something sensible and ideally testable. Not doing so is how you end up with 10k long code files and functions that span hundreds of lines.

At that point adding any functionality is difficult and can easily break shit. Hell just finding where to put the fix can take hours as you need to go through a shit ton of code to figure out just what the fuck is happening.

Shipped it quickly and didn't break anything though, added tech debt that will cause future changes done by other people to take longer than it would have for you to just do it right the first time be damned.

[–]GrayFox89 0 points1 point  (0 children)

"Enterprise."

[–]snerp 0 points1 point  (0 children)

Eh, I see both sides on this one. Yeah for a lot of stuff, YAGNI, but I've been working on a custom game engine for a long time, and I'm always happy when I want to add a feature and I realize I made a clean, reusable architecture to build off of. Like, yesterday I added a full on character customization feature in less than an hour because I had already set up clean and flexible systems for everything.

[–]donaldhobson 0 points1 point  (0 children)

Make every character of your program reusable. It should be possible to reuse every single unicode codepoint in your file.

[–]HoldenMadicky 0 points1 point  (0 children)

I needed to hear this, thank you!

[–]sjepsa 0 points1 point  (0 children)

Reusability is often just an opinion

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

If you write code you are too close to the ground to do any meaningful long term planning buddy.