A leaky abstraction fails to hide enough implementation detail. Although it promises a simple interface, using it still requires knowledge of what lies underneath, creating coupling to those details. section 10.2.3
Leaks commonly appear when:
- Calling code handles package-specific errors, such as exceptions raised by requests.get. section 10.2.3
- A high-level layer exposes low-level operations, reducing the freedom to replace or customize the implementation. section 10.2.3
- Business logic formats user-facing messages or directly calls database operations. section 10.3
Bookmark command
In AddBookmarkCommand, db.add couples the command to a database, while return 'Bookmark added!' makes business logic responsible for presentation. Replacing the database with a JSON file or changing the user interface would require changes in this command. section 10.3
Use the figure to visualize how an abstraction can expose the details it was meant to hide. section 10.2.3


