4 ms·
When you're using libraries, you're actually making your own custom framework. Because a framework is basically a set of libraries that work together to help y
by gitaarik 12y ago
When you're using libraries, you're actually making your own custom framework.
Because a framework is basically a set of libraries that work together to help you get to a certain goal.
If there's already a framework that helps you get to a certain goal, it can save you a lot of work to use that existing framework instead of making your own. It can also save you a lot of security issues.
But if your requirements don't really connect to the things existing frameworks provide, you'll have to build your own custom framework by collecting all the libraries you need and making them work together the way you want. Maybe you can make a framework out of it so the next person that has the same requirements as you doesn't have to go through this process again.
- onion2k 12y agoBecause a framework is basically a set of libraries that work together to help you get to a certain goal. Arguably a framework is a lot more than just a set of libraries - it's a formal specification for how you layout your code, from what directory you put a class in to how you do your database migrations. Dropping a few libraries in to an app won't make you work in a specific way. Using a framework will.
- girvo 12y ago> Because a framework is basically a set of libraries that work together to help you get to a certain goal. In theory, sure, and as another poster said that's exactly what the PHP-FIG (PHP Framework Interoperation Group) have achieved over the past year or two. However, in practice, the big frameworks that most developers and employers use give you much more than just a set of easily plugged together libraries, typically enough more that you end up building software on-top of that framework, and extracting your product out onto another or swapping a library out becomes nigh-on impossible.
- iopq 12y agoYou call a library, but a framework calls you. A framework IS the entry point to your application. If you use libraries you write your own entry point.
- andybak 12y agoAnd there's exceptions to each case. I can see the distinction that people are trying to make here but it's far from a binary one.
- deleted 12y ago[deleted]
- wedesoft 12y agoYes, if a library is implemented in a language which supports closures, the difference between it and a framework starts to vanish.
- adamnemecek 12y agoCan you name some of these exceptions?
- maemre 12y agoIn Flask, you call the framework, then it calls you back etc. It is a minimal framework that you can use as a library along other "plugins" (which are libraries in fact) you like.
- chongli 12y agoFrameworks tend to be more tightly coupled than libraries. They impose more opinion onto your code and make it harder to achieve modularity. They also tend to show up in languages which lack critical features for achieving proper modularity.
- aikah 12y agoIt depends whether the framework is based on IoC containers or not.Rails and Django certainly are what you describes,Symfony 2 isn't. Truth is,with dependency injection, one doesn't need a framework.But most people writing Ruby or Python apps don't understand the value of a registry that lazy-loads objects and it's dependencies.They mix module systems with IoC .
- secoif 12y agoIf you're going to not use a framework, then end up creating a framework, then you've defeated the point of not using a framework and you might as well have used an existing framework and saved yourself the effort. It's entirely possible to build applications without infecting it with anything that looks like a framework if you resist the urge to create unnecessary abstractions and keep coupling to an absolute bare minimum. Keep it simple and focus on the task at hand.
- jameshart 12y agoA framework is a set of decisions that have already been made for you - which might include 'we should use these libraries', but could also be 'we'll put our CSS files here' or 'all URLs will look like this'. That can be a huge help - unless any of the decisions are wrong for your use case. Deciding to use a library might, of course, also force some other decisions, because the library has dependencies, but the decisions should be more constrained than they are for a framework.
- coldtea 12y ago>When you're using libraries, you're actually making your own custom framework. Yeah. Back in the day we called that "writing a program".