DEV Community

Discussion on: Understanding SOLID Principles: Dependency Inversion

Collapse
 
myleftshoe profile image
myleftshoe

Your example is a much easier way of "grokking" the principle than reading the definition, even it's name. I guess we need a name in order to "put a name" to a concept but sometimes solving a coding problem will lead to a solution where you use a principle without knowing it.

e.g. not sure what db I'll end up using for this project - I'll make it so I can switch databases easily. Which means creating a common interface for the crud methods, abstracting the db specific details away and passing the database in.