Hacker News new | ask | show | jobs
by discreteevent 1126 days ago
> you’re not artificially restricted by the mental model encoded in the API

Most of the time I want a restricted mental model because I have so many API's to deal with that if they are not restricted my "mental model" breaks down. Suppose I am using a sockets library. I want to use that like a black box. I don't want that code arbitrarily mixed in with my code. I want to be able to debug my code separately because I assume that 99% of the time the bug is in my code and not the sockets lib etc. etc.

Even when most of the code is my own I will still split it into modules and try to make those as black box as possible in order to manage complexity.

1 comments

I tend to write facades for many libraries/APIs I use and use the facades, not the actual APIs throughout the project. The facades, aside from being simpler to replace in case I need to switch dependencies, also use a simpler mental model suitable for the project (and me).