4 ms·
Most programmers wouldn't know an abstraction if it hit them in the face. In fact, I highly doubt that most existing technology stacks allow you to build any ab
by catnaroek 9y ago
Most programmers wouldn't know an abstraction if it hit them in the face. In fact, I highly doubt that most existing technology stacks allow you to build any abstractions at all, in the original sense of functionality so self-contained that a user can't distinguish it from a programming language primitive, not just syntactically, but also semantically. In particular:
(0) If you need to know or care about its implementation details when you use it, it's not an abstraction.
(1) If unrelated ad hoc cases are hardcoded together into a single procedure, it's not an abstraction.
(2) If it needs fifteen tunable parameters, some combinations of which don't even make sense, it's not an abstraction.
At some point in time, programmers discovered that selection (if, switch, pattern mathcing, whatever) could be replaced with dynamically dispatched first-class procedure calls. Since then, they haven't stopped making their code more “abstract” by making their control flow impossible to follow. Alas, this isn't real abstraction, because it doesn't achieve the intended purpose of reducing the number of things you have to keep in your head simultaneously.
So, rather than blaming “wrong abstractions”, I'd blame “not real abstractions”.
- com2kid 9y ago> In fact, I highly doubt that most existing technology stacks allow you to build any abstractions at all, in the original sense of functionality so self-contained that a user can't distinguish it from a programming language primitive Two of the most popular languages out there, C++ and JavaScript, are both great at this. Sometimes, too great.
- catnaroek 9y agoAre you serious? How do I define complex numbers (just to give one example) in JavaScript that actually behave like, you know, complex numbers? Recall that: (0) The usual symbol for complex number addition is +. (1) The operation isn't associated to any individual complex number (i.e., it's not an object method), but is rather an intrinsic part of the algebraic structure of the complex numbers. (2) Complex numbers don't have a physical object identity in memory. C++ fares a little better than JavaScript, but not a lot better.
- com2kid 9y agoThe major JS frameworks look like languages onto themselves. JavaScript lacks operator overloading, so there are some limits, but it is quite possible to turn JS into something very unrecognizable. C++ templates allow for almost anything. I have seen incredibly strange things done to the language with templates. Since Templates can be used to parse, and execute, entirely different programming languages, it is hard to imagine a level of abuse to which C++ templates are not amenable.
- catnaroek 9y ago> The major JS frameworks look like languages onto themselves (...) it is quite possible to turn JS into something very unrecognizable. That doesn't mean anything. With enough determination, anything can be turned into “something very unrecognizable”. Heck, sometimes the results are relatively pleasant even: http://libcello.org/ http://libcello.org/ . But, if a language doesn't allow you to define basic abstractions like complex numbers (not to mention slightly more elaborate ones, like queues that are indistinguishable from one another if they contain the same elements in the same order), then that obviously reflects very poorly on its abstraction facilities. > C++ templates allow for almost anything. I have seen incredibly strange things done to the language with templates. What you can't do in C++, however, is make your abstractions not leak. Every template library is one template specialization away from being broken. This is unlike languages that enforce their abstractions by more robust means, like parametricity and macro hygiene.