Well-thought permanent solution. Deprecated after 3 months due to requirements change
This is why you don't write code you don't need. The number of times I've seen hundreds of lines of some overwrought generic extensible solution trying to anticipate requirements that didn't exist that could be 20 lines of easy to debug no-bullshit code is too damn high.
that's why web back end development is great. drink coffee, write shit code fast, make money. gonna scrap half of it in a year anyway. and if it breaks, who cares, it's just a stupid website, not Boeing control software
New college grads try to flex their degrees instead of meeting their specifications. If it doesn't need to be scalable then your burning time and company dollars until a manager sees what's going on and puts the boot down. Considerations for future functionality need to be considered, but if the management decision is to put it on the back burner you do a disservice trying to backdoor it in.
You have the kind of faith in management that I, as a PM, have in most devs, but I can tell you that one of us is wrong repeatedly about the initial feeling of whether something should be scalable or not and it's not them.
Most important skill I've learned as a PM is to shut up where I'm not 100%. The budget takes care of most critical decisions anyway.
I've been on both sides of it. As a PM it's unfortunate to be stuck between the devs and management. But that's why that role exists. Nothing feels better than having everyone aligned.
Interface-based development is more than "you make an interface so you can plug multiple implementations" into it, though. Helps keep good code decoupled and reduces dependency infestation across projects and classes. Makes it easier to mock/fake too when testing code.
Making an interface for a class is not some symptom of overengineering a simple solution, nor does it take excessive amounts of time to do.
Agreed. Everyone here glorifying spaghetti code, because business...? It's like you save time and money in the long run by writing clean code. But literally in every field it's like the only thing thst matters is right now. This quarter. Not long term viability. In code and in business.
Also, if you do not use interfaces, you have to make 1 huge pull request for the entire feature that no reviewer actually reads.
With interfaces, you can create several digestible cohesive pull requests that can be merged in separately without breaking the application. Some interfaces just remain temporarily without an implementation.
I'd wager it's true in most cases, in my experience. If nothing else I know I'd rather have an overabundance of interfaces than not enough. (And frankly I've yet to see someone doing it for the sake of doing it and providing no benefit to the application.)
Yep. I had OPs opinion years ago before I understood their value.
Also helped when I realised if they're single use interfaces just chuck them in the same file as the implementation so it doesn't overcrowd the file structure.
Although there's been a number of times I've wrote something to be extensible, because there were solid plans for specific features and upgrades. And I know the hell of repeatedly patching a hastily thought out single purpose solution into multiple rounds of new features by many different people, until it becomes an unstable spaghetti monster.
However, those beautiful plans for features and upgrades are never actualised, because some other "high priority" task barges in, and then another... Now that original feature is sitting there alone and unnecessarily extensible. The overhead of extra redundant code weighing on it.
It sits there for years and then some day in the future a junior developer is tasked with actually extending it! But they have little time to do it and they don't understand the design pattern; it's too much code! So they hastily patch in something of a completely foreign pattern that doesn't touch any of the extensibility mechanisms. And it becomes it's own monster.
I think with time I am ever finding the middle ground and ways to help future maintainers properly, but it's a delicate matter.
242
u/tiberiumx Nov 25 '22
This is why you don't write code you don't need. The number of times I've seen hundreds of lines of some overwrought generic extensible solution trying to anticipate requirements that didn't exist that could be 20 lines of easy to debug no-bullshit code is too damn high.