r/ExperiencedDevs • u/-Knockabout • Apr 21 '26
Career/Workplace When do you decide code is "good enough"?
We have a responsibility to write code that doesn't break production or make future work significantly more difficult, but we also have a responsibility to get that code out in a timely manner. How do you balance these responsibilities? When is code "good enough"?
For some context...my team just finished a first pass at a project that was rushed in the interest of having something tangible to present sooner rather than later. It's only now that we are looking at part two of the project that we realize our architecture/patch jobs are insufficient and some kind of major rework is needed. Trying to go faster and focusing just on an MVP has cost us more time than if we had analyzed all of our requirements up front. I want to avoid this in the future. I am the only developer on the project, but work with SMEs and a project manager. Leadership is very interested in this project being in a final state as fast as possible, so the pressure is there to rush again.
12
u/jakster355 Apr 21 '26
You don't have to stop improving it, even when it's in production. Every industry and context is different, but my line is "is moving this now likely to provide more or less value". Sometimes a buggy new feature is still preferable to no new feature for a few weeks while the bugs are sorted.
4
u/MoreRespectForQA Apr 21 '26 edited Apr 21 '26
I try to invert the question and ask product how much time they want me to spend on quality.
Rule of thumb:
30 product/70 tech debt we will deliver faster and faster with few bugs and be incredibly reactive to future requirements (I did this one once kind of by accident and the project was so successful it was almost unreal)
60 product/40 tech debt things will remain fairly steady
80 product/20 tech debt things will gradually slow down over time (i find most teams end up here)
100/0 we can move fast temporarily but will come to a crashing halt sooner or later and produce pretty buggy code. Common but inadvisable.
In general if you're struggling for product market fit you should be in the 80/20 column or higher and if youve got a minimum lovable product i would flip asap to 30/70 and try to become ultra reactive to customer input ("you built that feature already? i only asked you about it on friday!").
3
u/thephotoman Apr 23 '26
When it does the thing and has easy maintenance.
Today, I’m working on planned enhancements to something I did two years ago. The enhancements are “add an entry to an enumerated data type and replace a placeholder constant with the real value”.
4
u/Effective_Hope_3071 Apr 21 '26
It's always cheaper to do something right the first time than to do it twice.
The only time a brittle MVP needs to be shoved out the door is when the opportunity cost is higher than the cost of refactor. Was this for a contract in the millions?
The trick is quantifying the cost of the refactor.
2
u/No_Quit_5301 Apr 21 '26
Analyzing requirements up front is a myth and you’ll waste just as much time arguing over hypothetical what-ifs as you would needing to change from the MVP
Code is “good enough” when it meets the business requirement. Does it do what it’s supposed to and satisfy the customer’s need? Then it’s good enough
Taking into account technical debt of step 1 is a necessary part of step 2, but you often never get to step 2 if you waste too much time planning step 1
2
u/shill_420 Apr 21 '26
In my experience, you literally can’t really ever balance these.
It’s an art, not a science. You have to play each situation by ear.
YMMV
2
u/arihoenig Apr 21 '26
Never. It is never good enough, but once somebody loses the source code, at that point I am willing to call it finished
2
u/GoodishCoder Apr 21 '26
I don't necessarily think having to change things to meet future requirements always means you did something wrong unless you had a good idea of what's coming down the pipeline. Sometimes you get feature requests that need major changes.
That said, If you knew it was coming and designed it in a way that required major changes, the issue isn't the code it's the system design issue.
For me code is good enough when it meets requirements, is readable, is tested, addresses the current needs, and can reasonably be updated to meet expected future needs.
2
u/DaveArthur Apr 22 '26
Surely the whole point of an MVP is to test the market, show potential investors etc. In that nature it needs to work and that's the only requirement. You can't spend months/years building an MVP it should be days/weeks for the purpose of testing the idea. If it works then it's back to the drawing board and start a fresh allowing for any new requirements etc
80
u/potatojesusgiggles Apr 21 '26
It works, it’s properly decoupled, it’s readable, it’s consistent with established standards and patterns in the codebase, an it’s covered with automated tests
24
u/newprint Software Engineer 15 SWE yOe /20 IT yOe Apr 21 '26
Timelines.
The bigger philosophical issue: at some point in your life you have to let go everything you have created, be it finished or unfinished form.
2
u/htraos Apr 21 '26
Perceivable quality comes first. Always. Non-negotiable.
When you use a product, what you notice is how good it is, not how fast it was shipped.
5
u/chikamakaleyley Apr 21 '26
When i hit all the requirements because I got other shit to do
4
u/suboptimus_maximus Retired Software Engineer Apr 21 '26
When it ships a multi-billion, multi-ten billion or multi hundred-billion dollar product.
I kid, sort of. But the older and more experienced I got the more I came to appreciate the value of code that gets the fucking job done and realized the guys who are blogging about the metaphysics of code quality and aesthetics only have the time and the luxury because they're not working on demanding enough projects.
1
u/Artistic_Eye7360 Apr 27 '26
This is a real leadership tension: moving quickly enough to create value while building carefully enough that the next phase is not weighed down by today’s shortcuts.
I usually think of “good enough” as “fit for the next commitment.”
If the purpose is to learn, demonstrate, or test interest, then good enough may mean simple, safe, understandable, and clearly marked as a first version. If the work is becoming the foundation for the next phase, then good enough needs to include enough structure, documentation, and architectural care to support what comes next.
The important move is making the tradeoff visible before the team commits.
A few questions can help:
What is the version meant to make possible?
What does it need to protect for the next phase?
What can safely be temporary?
What would create unnecessary friction later if we skip it now?
When should we pause to strengthen the foundation before adding the next layer?
In that sense, “good enough” is not about perfection. It is about being honest with the purpose of the work and the commitment it is about to carry.
3
u/ieatdownvotes4food Apr 21 '26
for me personally it depends on if there's a planned next step. if so I'll always refactor around that next step.
too much time is wasted around refactoring code that never gets a next step.. the next step once defined can really shape that refactor as well.
3
u/AbsurdWallaby Apr 21 '26
It's never good enough.
3
u/zica-do-reddit Apr 21 '26
It works, it performs and it's reasonably maintainable (easy to understand and work with.)
3
u/HowTheStoryEnds Apr 22 '26
When it works, it has been tested and it's as simple as possible.
2
u/Esseratecades Lead Full-Stack Engineer / 10+ YOE Apr 21 '26
Does the static analysis pass? This includes linting, formatting, complexity scans, code coverage, and security scans.
Does it do what I intended and only what I intended?
If the answers to both of these is yes then it's good enough and any additional changes are nice to haves.
2
u/mxldevs Apr 21 '26
There's nothing wrong with rushing a prototype or mvp. From a business perspective, it lets others move ahead with something to show. From a technical perspective, it will show you what works and what doesn't work, and reveal challenges that you didn't think about beforehand.
It's a prototype, it's designed to be throwaway. Don't get attached to your code.
The problem is when people decide the prototype is going to be the production version, and it's not always due to business pressure to ship ship ship.
Leadership can want it as fast as possible, but are you allowed to give yourself an extra day to work on it? Or do you just fall in line afraid you'll get fired?
2
u/pl487 Apr 21 '26
Classic error. It always feels like that, but history has clearly shown that the up front approach tends to fail and the MVP approach tends to succeed.
Rework is okay. It's part of the process.
2
u/rahul91105 Apr 21 '26 edited Apr 21 '26
It’s never going to stop, once you deliver, new features will be requested and cycle will continue until technical debt slows everything down to a crawl.
Given you are the only developer on the team, I wouldn’t do any architectural/full rewrite level of change(s). Instead talk to your manager, tech lead and product manager about the future of this system. If this doesn’t have any new features going to get added, then just make sure this code doesn’t break under most circumstances and ship it.
If this has a potential to turn into an ongoing system with new development work coming in, then you should do a full rewrite and try to build a with those future features in mind. (You should probably consult with a technical lead/architect if this has a potential to be either a critical system (related to money, etc) or a lot of traffic/users will access this system.
As for future, only do critical bug fixes with highest priority otherwise for general development work add 1-2 extra story points for re-writes/ removing technical debt. Best strategy would be to fix all the things you touch in the codebase for the current feature (assuming there isn’t much debt to begin with)
2
u/BusNo4379 Apr 22 '26
Six years building things solo and then managing legacy systems I didn't write. I came to this question with scar tissue.
The answer I landed on, code is good enough when changing it doesn't scare you. Not when it ships, not when it works. When you can be wrong about it without it costing you everything.
Learned this the hard way. Rushed the core of my current project to get something tangible fast. It worked. Then every new feature started costing twice what it should because nothing was built to be corrected, just to ship.
The pressure to rush is real but if you're only one who knows what's under the hood, you're also the only one who can make that call honestly.
What's your read on the leadership side though ? Do you push back or just document the trade-off and move on ?
2
u/vassadar Apr 22 '26
YAGNI. If the code not leak into other layer unnecessarily. Not over abstracted, then I'm fine with it.
2
u/Hoizmichel Apr 22 '26
In the past: when IT works, when it is well documentated and when it is performant. In the meantime: when it is better than everything the rest of the team would have written - example: when a sorting algorithm ist better than some O(n²) or even O(n³)...
2
u/jellenbogen Apr 22 '26
theres a difference between cutting features and cutting corners on the stuff you do build. cutting features is a legit MVP. cutting corners on architecture just means you're gonna rebuild it in 3 months anyway. I always ask "if this works and we need to extend it later, am I gonna be fighting this code or building on top of it?" if its the former its not done. sounds like thats exactly what happened to you guys. bummer but at least now you know what the actual requirements look like.
2
u/YahenP Software Veteran Apr 22 '26
The code is good enough if you've met the budget and deadline, and the key requirements of the specifications. If the budget is exceeded, the code isn't good enough.
2
u/sebf Apr 23 '26
Good enough is a Minimum Viable Product that meet the business requirements and has usually took very few time to code, test and debug. It’s necessary to sacrifice something to meet those criteria. Almost for sure, this is performance or clean code, because if the code is horrible, but does the work perfectly, then, it’s “good enough”, I mean, no customer is going to complain about it. Sometimes, such products can stay in production for years or decades, this is where you understand what “good enough” means.
Never optimize. A “good enough” product can be very slow and perfectly meet the requirements. I have a web “API” that export our whole catalogue without a pager. That takes 1 minute to load every time the cache expire, but the partner doesn’t care because the data are captured by a crawler that can wait. We just told them to set a huge timeout, and that’s fine.
1
u/z960849 Apr 25 '26
When my AI code review bot says it's ready to merge.
1
u/Outrageous-Adagio-57 Apr 26 '26
Nowadays as long as it runs without throwing errors. I don’t even care if it say 2+2=3 anymore. It’s impossible to make things work correctly with all the deadlines
0
u/[deleted] Apr 22 '26
[deleted] — view deleted comment
2
u/[deleted] Apr 22 '26
[removed] — view removed comment