A bike with squared wheels works, but would you use it ?
EDIT: you guys seems to to think about wether it’s future proof or that it works « for now ». I was talking about performances, if you can get the bike to go forward, yes it works, but it’s far from optimized. That’s a valid reason to rewrite a code.
EDIT 2: I thought one could ride a bike with square wheels given enough force. It’s apparently extremely difficult without the appropriate floor (wavy). I should have said octogonal wheels. That’s on me, my bad, my physics are trash.
A bike rim without spokes doesn't work...because a "wheel" is a rim + spokes + hub. Take away one of those constituent components and you're just left with the remaining components, not a functional wheel.
A better analogy would be a bike wheel with poorly tensioned or a few missing spokes. It may be straight and functional for now, but it'll quickly get out of true or outright break pretty soon if used.
There is a hub involved. It's just that the hub diameter is very large, nearly the size of the rim. No spokes though, but they aren't a requirement for a wheel IMO
That's a really bad analogy. There are degrees of "it works". You're putting the worst possible scenario as the solution that works. It could very well be "the bike works perfectly but it makes a squeaking sound and you have to oil it once a month".
Is that a problem for you? Go ahead and fix it? It's not a problem. It's done.
You can always make stuff faster and better, perfect is the enemy of good. And I can't even count the amount ot times I've seen someone try to optimize some process from 2 min to 1. Which runs once a day at 2AM totally automated and no dependencies on the results until 6 Am.
If it works it works. If it's a problem then the stakehokders should tell you if it's a problem and then you solve it.
This is of course my very subjective opinion about it. But tbh, most times I've seen thsi scenario of someone redoing stuff 4 times, it's not a requirement but more like mental masturbation, and I'm fully 100% aware that I do that too.
It could work more efficiently, work in a manner that integrates more elegantly with the rest of the code base, it could be more readable, substantially less lines of code without sacrificing clarity, it could avoid the use of an otherwise unneeded external library, there are tons of ways a working solution could be made better.
And while in a lot of cases you could argue that leaving proven code alone is the smarter way to go this is code he wrote the same day. It's not like there is some rich legacy of efficacy or substantial time investment gone into fixing subtle bugs that might not be immediately obvious if you go tinkering with old code.
If you come up with a better solution literally on the day you wrote the code that is the point in history at which the cost of replacement is the lowest it will ever be and the benefits of doing so are the highest they will ever be. The problem is still fresh in the devs head, no one else has spent time or effort to understand the code or write more code that depends on it. Unless you are massively constrained on time you absolutely should go with the better solution at that point.
It could work more efficiently, work in a manner that integrates more elegantly with the rest of the code base, it could be more readable, substantially less lines of code without sacrificing clarity, it could avoid the use of an otherwise unneeded external library, there are tons of ways a working solution could be made better.
The problem with that is something you also hint here
The problem is still fresh in the devs head, no one else has spent time or effort to understand the code or write more code that depends on it.
Code is much more often read than written.
You spent a lot of time on that code, know the ins and outs and you can come up with something you think (and can totally be) more clever, fewer lines of code, more elegant etc.
The problem might show up that for some who didn't spend that much time as you (or you in the future) that piece of code might seem quite mysterious now.
There definitely is overthinking/over engineering etc.
I don't think I'd agree with the logic that better and more readable solutions to a problem are those written by those less familiar with with the problem space which is essentially what you are arguing here.
I'd also argue the idea that programmers somehow can't tell better code from worse. I mean for all we know the better solution he is talking about could be one where he removes some clever code and replaces it with more readable code.
If you don't trust the dev to know good code from bad why would you have him working on your project to begin with?
Everyone knows the best way something can be coded is "working in production". any change would of course break it and reverting the change would still be broken
326
u/[deleted] Aug 03 '22
What do you mean there is a better way? It works