6 ms·
Lack of abstraction is also expensive: try writing something large in assembly. I'd say that lack of a language / system of notions adequate to the subject are
by nine_k 4y ago
Lack of abstraction is also expensive: try writing something large in assembly.
I'd say that lack of a language / system of notions adequate to the subject area is expensive. The desire to describe things in a way that's efficient for a particular class of problems leads to invention of various frameworks. Say, Rails makes you hugely productive at solving a particular type of problems (see [Shopify]), though it's less than helpful if you try to apply it to unfitting problems (see [Twitter]).
[Shopify]: https://tomaszs2.medium.com/how-shopify-handled-1-27-million-requests-s-during-black-friday-cyber-monday-8a4b1d0dd1f9 https://tomaszs2.medium.com/how-shopify-handled-1-27-million... (Sorry for a Medium link)
[Twitter]: https://www.theregister.com/2012/11/08/twitter_epic_traffic_saved_by_java/ https://www.theregister.com/2012/11/08/twitter_epic_traffic_...
- ghaff 4y agoThe headline is sort of misleading. It is (appropriately) primarily about inappropriate abstractions. As you say, some abstractions are unavoidable. Even assembly language is an abstraction.
- cryptonector 4y agoThat's why real programmers write binary object code directly.
- nine_k 4y agoDon't tell them about the lost art of loading microcode on boot.
- fnordpiglet 4y agoI wire my magnetic core with artisanal copper.
- choeger 4y agoYou use copper? These kids today...
- noam_k 4y agoRelevant xkcd: https://xkcd.com/378/ https://xkcd.com/378/
- PeterCorless 4y agoDammit, emacs!
- LAC-Tech 4y agoAh yes, the All Abstractions Are Equal fallacy.
- naasking 4y agoBinary is an abstraction. I tap the clock and data lines line manually with a battery. Boy are my fingers tired.
- agentultra 4y agoI pick only the best artisinal integer representations for my programs. Only fools use abstractions.
- dlivingston 4y ago> Even assembly language is an abstraction Is this true? I thought assembly mapped 1-to-1 with actual HW instructions. If so, assembly wouldn't be an abstraction, it would be an interface.
- Spivak 4y agoNope, the CPU presents you an interface of the available instructions but those instructions are a complete fiction on modern processors and don't have to match at all what the underlying hardware does. The CPU guarantees that the observable effects of the instructions are consistent (i.e if the processor wants to do some fuckery it can't change the instruction semantics) but beyond that is free to run your code however it wants.
- nine_k 4y agoSimpler RISC designs, like simpler ARM cores, more or less directly execute instructions; same for old 8-bit cores you can still widely find in MCUs. Complex high-performance cores, with pipelining, instruction fusion, and OoO execution, turn instruction stream into a microcode lava.
- Spivak 4y agoSo maybe the right thing to say is that assembly is a contract between you and the processor and the underlying implementation can map directly to hardware when appropriate but it doesn't have to. It is an abstraction over different underlying hardware implementations.
- nine_k 4y agoFirst of all, you normally use symbolic labels, not offsets for jumps; the assembler will calculate them for you, and a linker will possibly build a relocation table based on them. Then, any good assembler has macros. Also, data / text blocks, etc that are not code but an abstraction which the linker later uses. Writing machine code directly, as a byte stream, is fun, but is exhausting.
- taeric 4y agoI think arguing that assembly is an abstraction is going the wrong direction on why it is hard. Assembly largely forces numerical abstraction on your problem. Which is a lot harder to reason about than folks want to acknowledge. That is, higher level languages let you get farther away from the abstraction that is the computer itself. As such, you can have a less abstract program in a language that has higher abstraction away from the execution environment.
- cle 4y agoIME the best abstractions hide the underlying complexity by default, but allow you to "pop the hood" when necessary. The more this exposes the guts of the underlying implementation details, the better (though obviously that comes with tradeoffs around changing underlying impl details, although I think as an industry that we over-index on that too much, which leads to exactly this problem). Go's compiler intrinsics immediately come to mind here. They allow you to easily write Go functions in native assembly, without CGo, for hot code paths. We get the benefits of a high-level language with a fat runtime, but can easily drop down to assembly when we need to.
- anfilt 4y agoIn my opinion good abstractions layers should also have a way to peel things back like layers of onion. Taking the authors example of a TCP network stack you often can't do though since OS won't let you have that low level of access by default without using or writing some custom driver since the OS ends up trying to isolate usee-space completely. Kinda makes me wish more research has been done on things like exo-kernels where the OS is mainly concerned with security and not the abstraction. All the abstraction runs in user space on such a kernel and you can choose what level is suitable for what your doing. https://en.wikipedia.org/wiki/Exokernel https://en.wikipedia.org/wiki/Exokernel
- pclmulqdq 4y agoI wrote the piece. The argument I tried to get across is: "You must use abstractions. Find the ones whose values align with your interests." I find people frequently torturing their problems into abstractions they like rather than finding abstractions that work for their applications, and this is very much wrong. Edit: By the way, the examples are fairly low-level databases because that's what I know about. If I knew about web frameworks, I would have used those instead.
- danielmarkbruce 4y agoThe material is good, nice going. But the title is misleading.
- danShumway 4y agoI would argue that abstractions are usually expensive. It's just that sometimes not doing something expensive is also expensive. Getting your car regularly maintained is expensive, so is not doing that. The issue with abstractions is that people have not internalized them as "an expensive thing we do to prevent ourselves from running into expensive problems later"; they're internalized them as a zero/low-cost process that has no downsides and thus should be pursued all the time. It's like if people said, "not getting your oil changed will be more expensive, and therefore I get my oil changed every other week." I kind of think that the only reason that the phrase "abstractions are expensive" sounds like a controversial take is precisely because people have not internalized that abstractions are not a binary good/bad thing and that they should be applied situationally, because they do have maintenance costs and development costs.
- danielmarkbruce 4y agoSure, the statement isn't wrong. But the content is mostly about making good/consistent choices given the situation.
- danShumway 4y ago
- LAC-Tech 4y agoLack of abstraction is also expensive: try writing something large in assembly. I can't think of a single "best practice" abstraction we have in web development are anywhere near as watertight and useful as what C offers over assembly. React VS The DOM is more like CFront over C.
- 1vuio0pswjnm7 4y ago"Lack of abstraction is also expensive: try writing something large in assembly." What about writing something small.
- kenjackson 4y agoAnd then using that small thing as a subroutine that you can call into to repeat that same functionality...
- kenjackson 4y agoRight. Abstraction has cost. It may or may not be expensive. Know the cost and then decide if it's worth the cost.
- khiqxj 4y agoruby is a poor abstraction AND inefficient. text based manipulations and crap like IFS are terrible abstractions. languages like standard ML were made SPECIFICALLY for abstracting. they literally were meticulously designed to provide proper abstractions (think, for example how the elements of a union type are abstract objects, and can be built up to model coherent ideas, while in ruby any variable probably requires a lookup at runtime in ascii^Wunicode^wunicode-minus-whatever-feature-was-found-to-be-harmful-in-this-context) what im saying is that the academic idea of abstraction is far better and less leaky than ruby (dynamic name resolution and such "scripting language" crap) or java (data structures are intended to be used once or twice per program (exaggerating) instead of fluently like you would make trees in a functional language); its just obscured but if everyone understood the motivation it would have replaced stuff like ruby in all use cases. i see ruby and java as a little shop where the owner will let you instantiate one or two objects according to some terms, and then let you maybe make your own class, but it will essentially just be a wrapper around a few of the shop's objects. whereas in ML you can model anything from the ground up, even numbers, and it will still be nicely implemented and the abstractions will be almost perfect.