Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 643 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the difference between a framework and a library?

#11
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][1].

*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.


[1]:

[To see links please register here]

Reply

#12
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)][1]. 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.


[1]:

[To see links please register here]

Reply

#13
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.
Reply

#14
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][1]". 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.

[1]:

[To see links please register here]

Reply

#15
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:
-----------------------------------------------------
![Library,Framework and your Code image relation][1]


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.][2]

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.


[1]:

[2]:

[To see links please register here]

Reply

#16
From Web developer perspective:

1. 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.

2. Mostly library takes very less learning curve compared to Frameworks. Eg: underscore.js is a library, Ember.js is a framework.



Reply

#17
**Library vs Framework**

[Martin Fowler - InversionOfControl][1]

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`[<sup>\[About\]</sup>][2] 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\]][3]

[\[DIP vs DI vs IoC\]][2]


[1]:

[To see links please register here]

[2]:

[To see links please register here]

[3]:

[To see links please register here]

Reply

#18
Based on the definitions given in the book [*Design Patterns*](

[To see links please register here]

) 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.
Reply

#19
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.
Reply

#20
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.

[![enter image description here][1]][1]

***
>
> **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).


[1]:
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through