Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The first few years at a previous startup I worked on. Java. CI/CD in place when merging PRs. But mostly, the thing that made the code base great was the fact that the code wrapped external libraries in small interfaces that were _owned by the company_, and dependency was used to not depend on implementation interfaces. In short, adhering to the basics on the SOLID principles.


Kinda sounds like abstraction hell. What did you gain by wrapping all external libraries in interfaces?


In my experience, any third-party dependency will inevitably eventually be in-sourced. Third-party dependencies are technical debt - they let you make fast progress initially, but have recurring maintenance costs.

Wrapping the API lets you see, all in one place, the surface area of an external API that is in use, and minimizes the changes required here when reimplementing it.

---

Also, not that Clean Code is any great authority (but it is popular!):

> [Wrapping] third-party APIs is a best practice. When you wrap a third-party API, you minimize your dependencies upon it: You can choose to move to a different library in the future without much penalty. Wrapping also makes it easier to mock out third-party calls when you are testing your own code.

> One final advantage of wrapping is that you aren’t tied to a particular vendor’s API design choices. You can define an API that you feel comfortable with.


oasisaimlessly's response says it all.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: