3 ms·
1. None of your objects should know how to create objects from other modules (just in case you happen to need the flexibility later). 2. Everything used in the
by tbrownaw 14y ago
1. None of your objects should know how to create objects from other modules (just in case you happen to need the flexibility later).
2. Everything used in the same place should use the same set of concepts (aka "level of abstraction", even tho abstractions can't always be split into clear levels).
So instead of your code knowing how to do something simple like create and use a database connection, you pass it a wrapper around a database connection and have it know how to use (but not create) that instead.
I'm not entirely clear on where the inversion-of-control (framework vs library) part fits in tho...