Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I've heard these terms used seemingly interchangeably, so I'm a little unclear. Please cite examples.
These terms, and others, do seem very similar. They're named from a conceptual standpoint, and so could be defined as follows:
A "framework" is a "foundation" or "support structure" around which you build your actual application. The .NET Framework includes not only a foundation (the CLR) but a series of libraries that provide standardized functionality that you would otherwise have to implement yourself. Other frameworks or foundations provide more specific areas of support, such as in UI, data storage, client-server interaction, etc. Frameworks provide a relatively static, generic structure on and in which you build something specific and unique.
An "engine" is a self-contained, but externally-controllable, piece of code that encapsulates powerful logic designed to perform a specific type of work. Engines exist to do "heavy lifting", where you instruct it to perform some complex, abstract task, and it handles the specifics in a relatively efficient manner without further external guidance. SQL implementations, and other services that perform searching, are typically called "engines". There are also physics engines, graphics engines, etc., which all have in common the idea that you tell it "do this" in some generic manner, and it handles the details.
A framework is something like a set of libraries that are meant to be able to work together. It's meant so you don't need to go around implementing common algorithms, and data structures. You use those libraries (the framework) to arrange them in a way so the functionality they provide helps you solve a problem.
An engine is a system, you feed it with data and it does it's job.
It's worth noting that a library can have an "engine" and an engine can be built using a framework.
A framework is mostly a bunch of component interfaces, but it does not implement those components. The framework does implement some glue code to help tie the framework together, and it provides some utility implementation for things that you’re likely to need.
A game engine implements all of the components defined in the framework… or at least all of the components that the game engine developer feels is required in order to implement his game engine. In some cases, an engine might not need physics or networking, etc, and so the game engine developer may choose to leave these components out of his engine.
Source: Frameworks vs Engines.
AFAIK a framework is the structure on which you build your applications. It differs from libraries in that it has inversion of control (i.e. in libraries, you call a subroutine from your code and so you have control; but in frameworks, you bind your subroutines to the framework and it calls your subroutine as and when needed - so the control is with the framework).
An engine is a totally different concept - it's a hybrid between a framework and a library. Like a framework, it has control over the application. However unlike a framework, you don't bind your subroutines to the engine but use its built in API to perform certain tasks (which is like a library).
In summary, a framework is the structure of the application which you can extend and tailor by binding your subroutines to it. OTOH, an engine is the main application itself which you can simply instruct to do what you want it to, using its public API.
Thus, frameworks are more flexible. However, an engine is a working application - so it gets the job done faster because the programmer doesn't need to waste time re-inventing the wheel. He can simply instruct the engine what to do and the engine will handle the internal operations.
An engine "does" the job for you.
A simple multiplication program.
A framework "simplifies" the job for you.
Instead of writing code for converting string to int and then presenting to engine, you have another code which converts it for you. This simplification code is a framework.
Framework examples:
PureMVC (Flash)
Spring (Java)
Engine examples:
Gecko
Google Search
A survey of different types of each gives a clue...
Engines
Search engine, an information-retrieval system designed to find information on a computer system
Game engine, the core software component of a computer or video game
Layout engine, software that formats web content for display on a screen
Rendering engine, software or hardware which converts specifications for images into pixels
Ray-tracing engine, software which renders a scene by tracing simulated rays of light
Polymorphic engine or mutation engine, an early conceptual or mechanical calculating device
Difference engine, a mechanical calculator designed to tabulate polynomial functions
Analytical engine, a concept for a computer, designed by Charles Babbage
Frameworks
Artistic drawing, music composition, and mechanical CAD
Compilers for different programming languages and target machines.
Financial modeling applications
Earth system modeling applications
Decision support systems
Media playback and authoring
Web applications
Middleware
I was trying to find an answer for my question today using google and StackOverflow search engines... but no luck :)
I was wondering what are the key features of every framework for end user, and how can you characterize every framework from the end-user point of view (I've looked into Framework Design Guidelines by K. Cwalina, but I've found only concepts and guidelines for framework architects), for me:
it should be extensible
should let build extensible and reusable components
and of course : Simple things should be simple, complex things should be possible. (http://en.wikiquote.org/wiki/Alan_Kay)
I think there is much more out there.
Please share your knowledge.
Here are two good quotes from Ralph Johnson and Brian Foote
A framework is a reusable, ``semi-complete'' application that can be specialized to produce custom applications
One important characteristic of a framework is that the methods defined by the user to tailor the framework will often be called from within the framework itself, rather than from the user's application code. The framework often plays the role of the main program in coordinating and sequencing application activity. This inversion of control gives frameworks the power to serve as extensible skeletons. The methods supplied by the user tailor the generic algorithms defined in the framework for a particular application.
There was a special issue of CACM that you might want to take a look at too.
Here's one more link The Hollywood Principal. "Don't call us, we'll call you." About how the framework inverts the typical control so the framework calls your code instead of you calling some library code.
It sounds like you just want to know what is the defining characteristic of a framework...?
From FOLDOC:
In object-oriented systems, a set of classes that embodies an abstract design for solutions to a number of related problems.
So basically, a class library ("set of classes") that's extensible ("embodies an abstract design"),
I'll attempt a definition based on my own understanding: A framework is a body of code that abstracts a subset of tasks common to some classes of application programs. The intent is to provide, once, proven and tested code so that application programming doesn't have to keep re-inventing code for the common tasks handled by the framework.
In real life, frameworks often spring into being when a programmer or team get carried away with generalizing and future-proofing what started out as a single application. There's an honorable intent to start code re-use, but it often turns out that such frameworks aren't designed with intent from the beginning, don't have consistent design reflecting this intent, and are actually lousy code that ends up not being re-used at all. Most architects who feel qualified to create frameworks, aren't.
The difference between libraries and frameworks: You call libraries. Frameworks call you.
Answering your question covering the depth it deserves is beyond the scope of this forum. All you should do is read this book though its focused on .Net frmaework specifically and written by the designers of the .Net framework, I'm sure the wisdom and information that this book provides would be sufficient to answer your question and satisfy your curiosities on the subject.
Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries (2nd Edition)
alt text http://www.lybrary.com/images/0321605012.jpg
A Framework is for me a other name for a Library (like Boost and many others) that is not about only one Topic (there are Librarys about Math, Networking, whatever out there, but these are no Frameworks) and it is of course Extensible and you can combine the Features of it to do your Job.
I have a set of functionality (classes) that I would like to share with an application I'm building for the iPhone and for the Blackberry (Java). Does anyone have any best practices on doing this?
This is not going to be possible as far as I understand your question - the binary format for the iPhone and Java are not compatible - and even for a native library on a blackberry device.
This is not like building for OS X where you can use Java unfornately the iPhone doesn't support Java.
The best idea is probably to build you library in Objective-C and then port it to Java which is an easier transition than going the other way. If you programme for Objective-C and make sure you code has no memory leaks - then the changes are not so complex.
If you keep the structure of your classes the same then you should find maintenance much simpler - fix a bug in the Java and you should find it easy to check for the same bug in the ObjC methods etc.
Hope this helps - sorry that it is not all good news.
As Grouchal mentioned - you are not going to be able to share any physical components of your application between the two platforms. However you should be able to share the logical design of your application if you carefully separate it into highly decoupled layers. This is still a big win because the logical application design probably accounts for a large part of your development effort.
You could aim to wrap the sections of the platform specific APIs (iPhone SDK etc.) that you use with your own interfaces. In doing so you are effectively hiding the platform specific libraries and making your design and code easier to manage when dealing with differences in the platforms.
With this in place you can write your core application code so that it appears very similar on either platform - even though they are written in different languages. I find Java and Objective-C to be very similar conceptually (at least at the level at which I use it) and would expect to be able to achieve parity with at least the following:
An almost identical set of Java and Objective-C classes with the same names and responsibilities
Java/Objective-C classes with similarly named methods
Java/Objective-C methods with the same responsibilities and logical implementations
This alone will make the application easier to understand across platforms. Of course the code will always look very different at the edges - i.e when you start dealing with the view, threading, networking etc. However, these concerns will be handled by your API wrappers which once developed should have fairly static interfaces.
You might also stand to benefit if you later developer further applications that need to be delivered to both platforms as you might find that you can reuse or extend your API wrappers.
If you are writing a client-server type application you should also try and keep as much logic on your server as possible. Keep the amount of extra business logic on the device to a minimum. The more you can just treat the device as a view layer the less porting you'll have to do over all.
Aside from that, following the same naming conventions and package structure across all the projects helps greatly, especially for your framework code.
The UI API's and usability paradigms for BlackBerry and iPhone are so different that it won't be possible in most cases to directly port this kind of logic between apps. The biggest mistake one could make (in my opinion) is to try and transplant a user experience designed for one mobile platform on to another. The way people interact with BlackBerrys vs iPhones is very different so be prepared to revamp your user experience for each mobile platform you want to deploy on.
Hope this is helpful.
It is possible to write C++ code that works in both a BB10 Native app and an iOS app.
XCode would need to see the C++ files as ObjectiveCPP code.
I am currently working on such a task in my spare time. I have not yet completed it enough to either show or know if it is truly possible, but I haven't run in to any road-blocks yet.
You will need to be disciplined to write good cross-platform code designed w/ abstractions for platform-specific features.
My general pattern is that I have "class Foo" to do cross platform stuff, and a "class FooPlatform" to do platform specific stuff.
Class "Foo" can call class "FooPlatform" which abstracts out anything platform specific.
The raw cross-platform code is itself not compile-able on its own.
Separate BB10 and XCode projects are created in their respective IDEs.
Each project implements a thin (few [dozen] line) "class FooPlatform" and references the raw cross-platform code.
When I get something working that I can show I will post again here...
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 months ago.
Improve this question
What is the difference between a framework and a library?
I always thought of a library as a set of objects and functions that focuses on solving a particular problem or a specific area of application development (i.e. database access); and a framework on the other hand as a collection of libraries centered on a particular methodology (i.e. MVC) and which covers all areas of application development.
A library performs specific, well-defined operations.
A framework is a skeleton where the application defines the "meat" of the operation by filling out the skeleton. The skeleton still has code to link up the parts but the most important work is done by the application.
Examples of libraries: Network protocols, compression, image manipulation, string utilities, regular expression evaluation, math. Operations are self-contained.
Examples of frameworks: Web application system, Plug-in manager, GUI system. The framework defines the concept but the application defines the fundamental functionality that end-users care about.
Actually these terms can mean a lot of different things depending the context they are used.
For example, on Mac OS X frameworks are just libraries, packed into a bundle. Within the bundle you will find an actual dynamic library (libWhatever.dylib). The difference between a bare library and the framework on Mac is that a framework can contain multiple different versions of the library. It can contain extra resources (images, localized strings, XML data files, UI objects, etc.) and unless the framework is released to public, it usually contains the necessary .h files you need to use the library.
Thus you have everything within a single package you need to use the library in your application (a C/C++/Objective-C library without .h files is pretty useless, unless you write them yourself according to some library documentation), instead of a bunch of files to move around (a Mac bundle is just a directory on the Unix level, but the UI treats it like a single file, pretty much like you have JAR files in Java and when you click it, you usually don't see what's inside, unless you explicitly select to show the content).
Wikipedia calls framework a "buzzword". It defines a software framework as
A software framework is a re-usable
design for a software system (or
subsystem). A software framework may
include support programs, code
libraries, a scripting language, or
other software to help develop and
glue together the different components
of a software project. Various parts
of the framework may be exposed
through an API..
So I'd say a library is just that, "a library". It is a collection of objects/functions/methods (depending on your language) and your application "links" against it and thus can use the objects/functions/methods. It is basically a file containing re-usable code that can usually be shared among multiple applications (you don't have to write the same code over and over again).
A framework can be everything you use in application development. It can be a library, a collection of many libraries, a collection of scripts, or any piece of software you need to create your application. Framework is just a very vague term.
Here's an article about some guy regarding the topic "Library vs. Framework". I personally think this article is highly arguable. It's not wrong what he's saying there, however, he's just picking out one of the multiple definitions of framework and compares that to the classic definition of library. E.g. he says you need a framework for sub-classing. Really? I can have an object defined in a library, I can link against it, and sub-class it in my code. I don't see how I need a "framework" for that. In some way he rather explains how the term framework is used nowadays. It's just a hyped word, as I said before. Some companies release just a normal library (in any sense of a classical library) and call it a "framework" because it sounds more fancy.
I think that the main difference is that frameworks follow the "Hollywood principle", i.e. "don't call us, we'll call you."
According to Martin Fowler:
A library is essentially a set of
functions that you can call, these
days usually organized into classes.
Each call does some work and returns
control to the client.
A framework embodies some abstract
design, with more behavior built in.
In order to use it you need to insert
your behavior into various places in
the framework either by subclassing or
by plugging in your own classes. The
framework's code then calls your code
at these points.
Library:
It is just a collection of routines (functional programming) or class definitions(object oriented programming). The reason behind is simply code reuse, i.e. get the code that has already been written by other developers. The classes or routines normally define specific operations in a domain specific area. For example, there are some libraries of mathematics which can let developer just call the function without redo the implementation of how an algorithm works.
Framework:
In framework, all the control flow is already there, and there are a bunch of predefined white spots that we should fill out with our code. A framework is normally more complex. It defines a skeleton where the application defines its own features to fill out the skeleton. In this way, your code will be called by the framework when appropriately. The benefit is that developers do not need to worry about if a design is good or not, but just about implementing domain specific functions.
Library,Framework and your Code image representation:
KeyDifference:
The key difference between a library and a framework is “Inversion of Control”. When you call a method from a library, you are in control. But with a framework, the control is inverted: the framework calls you. Source.
Relation:
Both of them defined API, which is used for programmers to use. To put those together, we can think of a library as a certain function of an application, a framework as the skeleton of the application, and an API is connector to put those together. A typical development process normally starts with a framework, and fill out functions defined in libraries through API.
As I've always described it:
A Library is a tool.
A Framework is a way of life.
A library you can use whatever tiny part helps you. A Framework you must commit your entire project to.
From Web developer perspective:
Library can be easily replaceable by another library. But framework cannot.
If you don't like jquery date picker library, you can replace with other date picker such as bootstrap date picker or pickadate.
If you don't like AngularJS on which you built your product, you cannot just replace with any other frameworks. You have to rewrite your entire code base.
Mostly library takes very less learning curve compared to Frameworks. Eg: underscore.js is a library, Ember.js is a framework.
I like Cohens answer, but a more technical definition is: Your code calls a library. A framework calls your code. For example a GUI framework calls your code through event-handlers. A web framework calls your code through some request-response model.
This is also called inversion of control - suddenly the framework decides when and how to execute you code rather than the other way around as with libraries. This means that a framework also have a much larger impact on how you have to structure your code.
I forget where I saw this definition, but I think it's pretty nice.
A library is a module that you call from your code, and a framework is a module which calls your code.
A framework can be made out of different libraries. Let's take an example.
Let's say you want to cook a fish curry. Then you need ingredients like oil, spices and other utilities. You also need fish which is your base to prepare your dish on (This is data of your application). all ingredients together called a framework. Now you gonna use them one by one or in combination to make your fish curry which is your final product. Compare that with a web framework which is made out of underscore.js, bootstrap.css, bootstrap.js, fontawesome, AngularJS etc. For an example, Twitter Bootstrap v.35.
Now, if you consider only one ingredient, like say oil. You can't use any oil you want because then it will ruin your fish (data). You can only use Olive Oil. Compare that with underscore.js. Now what brand of oil you want to use is up to you. Some dish was made with American Olive Oil (underscore.js) or Indian Olive Oil (lodash.js). This will only change the taste of your application. Since they serve almost the same purpose, their use depends on the developer's preference and they are easily replaceable.
Framework: A collection of libraries that provide unique properties and behavior to your application. (All ingredients)
Library: A well-defined set of instructions that provide unique properties and behavior to your data. (Oil on Fish)
Plugin : A utility build for a library (ui-router -> AngularJS) or many libraries in combination (date-picker -> bootstrap.css + jQuery) without which your plugin might now work as expected.
P.S. AngularJS is an MVC framework but a JavaScript library. Because I believe Library extends default behavior of native technology (JavaScript in this case).
This is how I think of it (and have seen rationalized by others):
A library is something contained within your code. And a framework is a container for your application.
I will try to explain like you're five. ( No programming term was being used. )
Let's imagine that you had opened a burger restaurant in your city a while ago. But you feel it's so hard to make a burger as a beginner. You were thinking about an easy way to make burgers for customers.
Someone told you that If you use framework, you can make bugger easily. and you got to know that there are McDonald Burger Framework and BurgerKing Burger Framework.
If you use McDonald Burger Framework, It's so easy to make Big Mac burger. (but you cannot make Whopper.)
If you use BurgerKing Burger Framework, It's so easy to make Whopper Burger. (however, you cannot make Big Mac)
Anyway, In the end, they are all burgers. An important thing here is, you have to follow their framework's rule to make burgers. otherwise, you feel even harder to make it or won't be able to make it.
And you also heard that there is something called Simple Burger-Patty Library.
If you use this Library, you can make whatever burger patty so easily (X2 speed).
It doesn't really matter if you use McDonald Burger Framework or BurgerKing Burger Framework.
Either way, you can still use this Simple Burger-Patty Library. (Even you can use this Library without frameworks.)
Do you see the difference between Framework vs Library now?
Once you started using McDonald Burger Framework. It would not be easy to switch to BurgerKing Burger Framework. Since you have to change the whole kitchen.
If you start to build Web Application using Java Spring Framework, It would be hard(maybe impossible) to change to Ruby on Rails Framework later.
But Library, It would be much easier to switch others. or you can just not to use it.
A library implements functionality for a narrowly-scoped purpose whereas a framework tends to be a collection of libraries providing support for a wider range of features. For example, the library System.Drawing.dll handles drawing functionality, but is only one part of the overall .NET framework.
Libraries are for ease of use and efficiency.You can say for example that Zend library helps us accomplish different tasks with its well defined classes and functions.While a framework is something that usually forces a certain way of implementing a solution, like MVC(Model-view-controller)(reference). It is a well-defined system for the distribution of tasks like in MVC.Model contains database side,Views are for UI Interface, and controllers are for Business logic.
I think library is a set of utilities to reach a goal (for example, sockets, cryptography, etc).
Framework is library + RUNTIME ENVIRONMENT. For example, ASP.NET is a framework: it accepts HTTP requests, create page object, invoke life cycle events, etc. Framework does all this, you write a bit of code which will be run at a specific time of the life cycle of current request!
Your interpretation sounds pretty good to me... A library could be anything that's compiled and self-contained for re-use in other code, there's literally no restriction on its content.
A framework on the other hand is expected to have a range of facilities for use in some specific arena of application development, just like your example, MVC.
I think you pinned down quite well the difference: the framework provides a frame in which we do our work... Somehow, it is more "constraining" than a simple library.
The framework is also supposed to add consistency to a set of libraries.
Library - Any set of classes or components that can be used as the client deems fit to accomplish a certain task.
Framework - mandates certain guidelines for you to "plug-in" into something bigger than you. You merely provide the pieces specific to your application/requirements in a published-required manner, so that 'the framwework can make your life easy'
I don´t remember the source of this answer (I guess I found it in a .ppt in the internet), but the answer is quite simple.
A Library and a Framework are a set of classes, modules and/or code (depending of the programing language) that can be used in your applications and helps you to solve an especific "problem".
That problem can be log or debuging info in an application, draw charts, create an specific file format (html, pdf, xls), connect to a data base, create a part of an application or a complete application or a code applied to a Design Pattern.
You can have a Framework or a Library to solve all these problems and many more, normaly the frameworks helps you to solve more complex or bigger problems, but that a consecuence of their main difference, not a main definition for both.
The main difference betwen a Library and a Framework is the dependency betwen their own code, in oder words to use a Framework you
need to use almost all the classes, modules or code in the FW, but to
use a Library you can use one or few classes, modules or code in the
lib in your own application
This means that if a Framework has, for example has 50 classes in order to use the framework in an app you need to use, let said, 10-15 or more classes in your code, because that is how is designed a Framework, some classes (objects of that classes) are inputs/parameters for methods in other classes in the framework. See the .NET framework, Spring, or any MVC framework.
But for example a log library, you can just use a Log class in your code, and helps you to solve the "logging problem", that doesn´t mean that the log library doesn't have more classes in his code, like classes to handle files, handle screen outputs, or even data bases, but you never touch/use that classes in your code, and that is the reason of why is a library and not a framework.
And also there are more categories than Frameworks and Libraries, but that is off topic.
What is a Library?
A library is a collection of code blocks (could be in the form of variables, functions, classes, interfaces etc.) that are built by developers to ease the process of software development for other developers that find its relevance.
What is a Framework?
With reference to the definition of a library, we could define a framework as a tool that helps a developer solve a large range of domain-specific problems by providing the developer with necessary libraries in a controlled development environment.
Based on the definitions given in the book Design Patterns by Erich Gamma et al.:
library: a set of related procedures and classes making up a reusable implementation;
framework: a set of cooperating classes with template methods making up a reusable specification. It sets the control flow and allows to hook into that flow for tailoring the framework to a specific problem by overriding in a subclass the hook methods called by the template methods in the framework classes.
Problem-specific code can use libraries and implement frameworks.
Library vs Framework
Martin Fowler - InversionOfControl
Library and Framework are external code towards yours code. It can be file(e.g. .jar), system code(part of OS) etc.
Library is a set of helpful code. Main focus is on your code. Library solves a narrow range of tasks. For example - utilities, sort, modularisation
your code ->(has) Library API
Framework or Inversion of Control(IoC) container[About] is something more. Framework solves a wide range of tasks(domain specific), you delegates this task to framework. IoC - your code depends on framework logic, events... As a result framework calls your code. It forces your code to stick to it's rules(implement/extend protocol/interface/contract), pass lambdas... For example - Tests, GUI, DI frameworks...
your code ->(has) and ->(implements) Framework API
[iOS Library vs Framework]
[DIP vs DI vs IoC]
Really it depends on what definition you give to the terminology. There's probably a lot of different definitions out there.
I think the following are nice explanations based on what I believe this terminology refers to:
Deterministic Library
A deterministic library holds functions that are deterministic based on either a) function input or b) state that is somehow maintained across function calls.
Should logic be dependency-injected into a deterministic library, such logic must conform to a concrete specification such that the output of the library is not affected.
Example: A collision-detection library which for some reason depends on a sorting function to aid in these calculations. This sorting function can be configured for optimization purposes (e.g. through dependency-injection, compile-time linkage, etc), but must always conform to the same input/output mapping, so that the library itself remains deterministic.
Indeterministic Library
An indeterministic library can hold indeterministic functions by communicating with other external indeterministic libraries that it somehow gained access to.
I generally refer to indeterministic libraries as services.
Example: A poker library which depends on a random-number generator service for shuffling the deck. This is probably a bad example, because, for architectural purposes, we should push the indeterministic aspect of this library to the outside. The poker library could instead become deterministic and unit-testable by taking in a pre-shuffled deck of cards, and it's now the responsibility of the user of this library to shuffle the deck randomly if they so wish.
Framework
A framework is in-between a deterministic and indeterministic library.
Any logic that is dependency-injected into a framework must be deterministic for the lifetime of that function instance, but different function instances of varying logic can be injected on separate executions of framework functions.
Example: Functions that operate on lists such as map, filter, sort, reduce, that expect to take in functions that are deterministic but can have varying logic for different executions. Note that this requirement only exists if these list operations advertise themselves as deterministic. In most languages, list operations wouldn't have this constraint. The core logic of such frameworks are deterministic, but are allowed to accept indeterministic logic at the risk of the user. This is generally a messy scenario to deal with, because output can vary widely due to implementation details of the framework.