by idontwantthis · 3y ago · 0 comments
Anything that is “premature” is per definition incorrect. So there is no information in that sentence.
Having said that, a lack of architectural abstractions leads to badly designed code with a WTF count reaching the heavens. Have you ever seen UI code directly relying on a specific flavour of SQL implementation and database? That’s an example of how a lack of architectural abstractions leads to spaghetti code. Or how about the domain logic directly relying on a specific UI framework? Another example where an early architectural abstractions would have saved years of maintenance work. Again something I see all the time in the wild.
leaky abstractions create more trouble than is worth it. If your abstraction does not fit the problem neatly do not abstract it.
> Having said that, a lack of architectural abstractions leads to badly designed code with a WTF count reaching the heavens.
> a lack of architectural abstractions leads to spaghetti code.
> domain logic directly relying on a specific UI framework?
If we are pedantic: lack of architectural abstractions, spaghetti code, and domain logic tied to an UI can also be interpreted as simply bad, so no information in either of our posts :)
Of course, I am joking. Saying that I think leaky abstractions are bad, or you saying that no abstractions are bad is new information (it reduces uncertainty). It tells us that we think that x is bad.
We can agree that bad abstractions are bad. In this thread, abstracting to early, or having leaky abstractions or not having any abstractions are just 3 positions on the topic of what a bad abstraction is.
I bet we could much easier agree with a specific example. In my experience all "big principle" discussions improve when we focus on a specific example. Otherwise people are thinking of different scenarios.
In any case, I can think of scenarios where each of those 3 positions is right, so I do not really disagree with any of them.
Could you please elaborate on that? I'm not sure to understand.
Write the simplest abstraction first, then as the system develops combine similar use cases into useful abstractions for clarity
Start out to broad and wind up wasting resources that could be put to better use.
Start out to narrow focus without knowing where need/$$ to keep going is and wind up wasting resources. Idealy, the narrower focus permits getting to the 'wasting resources' point faster.
Hiding the details via abstraction when details are still in development/need to be viewable & readily available defeats the purpose of abstraction making things simpiler/easier.