Earlier quoted context omitted.
That’s seems like it should be true, and it would be great if it was. But in my many years of experience working with Jr engineers, I have found no substitute other then practice guided by someone more Sr (who has good taste). There are just too many different situations and edge cases. Everything is situational. You can come up with lists of factors to consider (better versions of this post often have them), but no…
I wouldn’t call that “taste”. It’s not a matter of taste which solution is better. If different engineers disagree about which solution to choose, then it’s fundamentally a different assessment of the relevant factors, and not about taste. Or at least, it shouldn’t be the latter.
That's not an abstraction, that's a layer of indirection
221–230 of 240 posts
Re: That's not an abstraction, that's a layer of indirection
#222Earlier quoted context omitted.
The way to tell whether an abstraction is good or bad is to develop good taste. Engineers with good taste have intuition about these things. You are not going to acquire good taste from reading an article.
Relying on mere “taste” is bad engineering. Engineers do need experience to make good decisions, yes. But surely we are able to come up with objective criteria of what makes a good abstraction vs. a bad abstraction. There will be trade-offs, as depending on context, some criteria will be more important than other (opposing) criteria. These are sometimes called “forces”. Experience is what leads an engineer in assessi…
Re: That's not an abstraction, that's a layer of indirection
#223Earlier quoted context omitted.
Useless? Like the RTX2000 which landed on a comet kind of useless? Or do you mean some other kind of useless. Maybe the controlling radio telescopes kind of useless. That must be it.
> Like the RTX2000 which landed on a comet kind of useless? Yeah, in 1983 he designed a chip that was further developed by others for space usage. > Maybe the controlling radio telescopes kind of useless. Yeah, which he did in 1970. Note a pattern here? That this design paradigm holds up pretty well in a primitive computing world when things are simple and demands are low, and is thoroughly useless to keep on promoti…
We could use a point of comparison here.
Re: That's not an abstraction, that's a layer of indirection
#224Earlier quoted context omitted.
I can see the value of examples, but in this case I appreciate the post largely for its universality and lack of examples. On reading it, examples from past and present experience spring immediately to mind, and I'm tucking this away as a succinct description of the problem. Maybe I can share it with others when more concrete examples come up in future code review. A principle takes skill the apply, but it's still wo…
> examples from past and present experience spring immediately to mind Examples of what? Picking the wrong abstraction? Regretting your mistakes? I can certainly think of many examples of that. How you unwrapped an abstraction and made things better by removing it? I have dozens of battle stories. Choosing not to use an abstraction because it was indirection? Which is what the article says to do? I’m skeptical. I sus…
Re: That's not an abstraction, that's a layer of indirection
#225For example, binary logic is a perfect abstraction over semiconductor physics. No one doing computer science needs to understand anymore the complexities of voltages and transistors and whatever. TCP is a perfect abstraction over IP. Memory as a big array of bytes is a perfect abstraction over the intricacies of timing DRAM refreshes.
And that's about it. No one reading this post has written an abstraction ever. (a leaky abstraction is not an abstraction). So yes, actually, abstractions are free, and they don't leak. That's the whole point. The problem is that what you call an abstraction isn't an abstraction.
Computer science's complete failure to create a new abstraction since like TCP intrigues me. Why don't we have a system X that abstracts over memory accesses so well that no one needs to know anymore how caches or memory locality works? Why aren't there entire subfields studying this?
Re: That's not an abstraction, that's a layer of indirection
#226Who are you people who never have to debug TCP problems? I've had to do it on multiple occasions.
Re: That's not an abstraction, that's a layer of indirection
#227The best way to achieve a good abstraction is to recall what the word meant before computer science: namely, something closer to generalization . In computing, we emphasize the communicational (i.e. interface) aspects of our code, and, in this respect, tend to focus on an "abstraction"'s role in hiding information. But a good abstraction does more than simply hide detail, it generalizes particulars into a new kind of…
Supporting the third device was handed off to a junior dev. I pointed him at my subclass and said to just do that, we'd figure out the mixing and matching later. But he looked at my subclass like it was written in Greek. He ended up writing his own class that re-imagined the functionality of the superclass and supported the new device (but not the old ones). Integrating this new class into the rest of the codebase would've been nigh impossible, since he also re-implemented some message-handling code, but with only a subset of the original functionality, and what was there was incorrect.
His work came back to me, and I refactored that entire section of the code, and this is when the generalization occurred: Instead of a superclass, I took the stuff that had to be inherited and made that its own thing, having the same interface as before. The device communication part would be modeled as drivers, with a few simple functions that would perform the essential functions of the devices, implemented once per device type. I kept the junior dev's communication code for the new device, but deleted his attempt to re-imagine that superclass. Doing it this way also made it easy to mix and match the devices.
Re: That's not an abstraction, that's a layer of indirection
#228I got a piece of advice writing UI code a long time ago: Don't marry your display code to your business logic. I'd like to say this has served me well. It's the reason I never went for JSX or other frameworks that put logical code into templates or things like that. That is one abstraction I found unhelpful. However, I've come around to not taking that advice as literally as I used to. Looking back over 25 years of c…
Re: That's not an abstraction, that's a layer of indirection
#229Earlier quoted context omitted.
I don't think I'm conflating things. Any time you insert sugar into your HTML that makes your end user see output that's been inserted by how your framework interprets that sugar, you may be binding your business logic to your display code. Possibly in subtle ways you don't realize until later. A common case is rounding decimals to a user that aren't rounded in the system. Letting any control flow into your HTMX/JSX…
As someone who has little experience in this topic but has come to a similar conclusion, I think the main downside of this strict separation you're recommending is performance/efficiency. Have you noticed that to be a problem in practice? It's not always clear whether the simplest solution can actually be feasible, or perhaps that is just a reflection of still untapped understanding of the problem domain.