news.volyx.in

That's not an abstraction, that's a layer of indirection (fhur.me)

599 points by fagnerbrack · 589 days ago · 225 comments on HN

Article summary

The article discusses the difference between abstraction and layers of indirection in software development, arguing that not all abstractions are created equal and that some may add complexity without providing real value. A good abstraction is one that hides complexity and allows developers to operate as if the underlying complexity doesn't exist. The article also notes that abstractions have costs, including added complexity and performance penalties. The author advocates for using abstractions wisely and recognizing when they are truly simplifying a system versus just adding layers of indirection.

Main themes

  • Abstraction vs Indirection
  • Software Complexity
  • Performance Optimization
  • Code Modularity
  • Software Engineering Principles

What commenters say

  • Abstraction is about hiding implementation details and providing a general interface to a concrete thing, allowing for substitution of different but similar concrete things without changing the consumer.
  • Some commenters argue that the purpose of abstraction is not to be vague, but to create a new semantic level in which one can be absolutely precise, and that it is often confused with modularity.
  • Others suggest that abstraction is not just about hiding details, but also about providing a common language and interface for talking to different implementations, and that it requires theorems, laws, or properties to be truly effective.
  • There is disagreement on whether certain technologies, such as ORMs, provide true abstraction or just add layers of indirection, with some arguing that they can be useful for query composition but others seeing them as leaky abstractions.
  • Some commenters emphasize the importance of orthogonality in abstraction, where different components or modules do not interfere with each other and can be changed independently without affecting the rest of the system.
  • The distinction between abstraction and encapsulation is also discussed, with some arguing that encapsulation is about restricting access to an object's components, while abstraction is about hiding implementation details.
  • There is a warning against over-abstraction, where adding features or layers without a clear purpose can lead to unnecessary complexity and make the system harder to maintain and understand.