Hacker News new | ask | show | jobs
by globalreset 1088 days ago
That `run=true` was just bad API: "boolean trap", yada, yada. The rest of "80% abstraction" idea is not well supported, and I don't buy it.

The abstraction is either good or it isn't. Some stuff just does not abstract well. A function or an API is not necessarily "an abstraction".

1 comments

A function and API is always an abstraction as it hides the details of the implementation.

Since there are many ways to abstract the same concepts, splitting them into two categories (good, bad) where all the good abstractions are equally good and all the bad abstractions are equally bad seems an unrealistic and impractical way of looking at things.

> A function and API is always an abstraction

To a degree, yes. But they're not always introduced for that reason. There are cases, where the caller is expected to fully understand the implementation of a function, yet it may still provide value, for example, by:

- ...reducing the mental demand for understanding the calling code by making it easier to visually scan.

- ...reducing the mental demand for understanding the called code by narrowing the scope of the logic through parameters / encapsulation / etc...

- ...preventing repetition by being callable from multiple places