5 ms·
I think the distinction between frameworks and libraries is much more fuzzy and philosophical than what's presented here. A framework says "Here's how we're goi
by brundolf 5y ago
I think the distinction between frameworks and libraries is much more fuzzy and philosophical than what's presented here. A framework says "Here's how we're going to do things. I'll allow you to extend and build out in certain directions, but you have to use my channels." A library says "Here are some pieces, I don't know or care what you're going to do with them, figure it out." A framework is the Apple philosophy applied to code.
A framework's restrictions can be enforced by IOC, or by integration and compatibility between its subsystems (and incompatibility with alternatives), or just by strong conventions and tutorials/documentation that stick to a beaten path, or any combination of the above. I don't think the particular mechanisms of constraint are as important as the fact that there is constraint.
- config_yml 5y agoI’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"