October 02, 2006
The right amount of abstraction
In the comp.lang.c++ Usenet newsgroup today appeared a post by Marcus Kwok that included the following profound observation:
1) C is "easy" because it is a small language.
2) C is "hard" because it is a small language.
Every programming language is (among other things) an abstraction of the underlying hardware. Some such abstractions, such as assembly language, are closer to what they abstract than are others, such as C++.
An implication of Marcus Kwok's observation is that if you choose an abstraction that is too close to what you're abstracting, you don't gain much. On the other hand, if you choose an abstraction that is too far away from what you're abstracting, the abstraction itself may present new complexities.
Another context in which this phenomenon surfaces is in library design. A library that is too abstract may be more work to learn than it's worth; one that is not abstract enough may not offer enough power to be worthwhile.
Posted by Andrew Koenig at 01:26 PM Permalink
|