|
|
|
|
|
by aleksiy123
1088 days ago
|
|
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. |
|
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