4 ms·
I’m not sure who put it this succinctly, but I remember it generalized this way: a framework calls your code, but you call the library’s code.
by config_yml 5y ago
I’m not sure who put it this succinctly, but I remember it generalized this way: a framework calls your code, but you call the library’s code.
- Banana699 5y agoThis is inversion-of-control principle, popularized (but not coined) by Martin Fowler in an article of the same name. GP comment says it's not what defines a framework, it just happens to be a succinct summary of most methods that frameworks use to enforce the their philosophy, which is in GP's view what defines a framework: it has opinions and philosophy about how you structure your code, and it wants you to follow them.
- brundolf 5y agoThis is how the OP put it, and I'm pushing back against this definition.
- BulgarianIdiot 5y agoA framework calls your code, but in practice the term is loaded with a set of independent characteristics, such as it being the frame of your entire application, not just an aspect of it (libraries can also "call you" in some cases, no one forbids a library from taking in a callback function or an object). And with that, frameworks often become their own universe, where external components need to be "integrated" with the framework in order to enable using them pragmatically at all. So you either rely on the framework for everything, or you go looking for plugins for the framework, or if you need functionality outside it, it has to be integrated. Inversion of control is a great principle when used with care. In the hands of amateurs, it's used to just replicate the unit version of a "god object", where your entire application becomes a unit defined by the framework.
- garethrowlands 5y agoYou don't need a framework of any kind to do inversion of control though.
- BulgarianIdiot 5y agoI didn't claim otherwise.
- paozac 5y agoI knew it as the Hollywood Principle: "Don't Call Us, We'll Call You"