Question

I hear the whole day the terms class library, base class library, Framework, ...
What highlights a framework and what a base class library?

Was it helpful?

Solution

The distinguishing feature between a class library and a software framework is that in a framework, the flow of control is not determined by the user´s code, but by the framework.

This is also known as Hollywood principle (don´t call us, we call you).

By the way, there is also a nice Wikipedia article on this topic.

OTHER TIPS

You use a class library in writing your code, but you code within a framework.

The term "framework" is meant to invoke a sense of "being within an environment". If I were to put a (limited) analogy to it, I'd say that a class library is like being able to eat cheese and drink wine, whereas a framework is like visiting France; experiencing the culture. The framework is the structure around which you build your program. The class library are the tools you use (possibly within a framework).

Of course, a framework will typically contain libraries of classes. .NET, for instance, has heaps of class libraries which are included in the entire framework.

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

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.

Original answer

A class library usually is a DLL or a packet of classes that you can "include"/"reference" into your solution and reuse.

A framework is usually a recurring pattern/solution targeted towards a specific context e.g. a GUI Framework. A framework more than often implies that you write certain pieces as dictated by the framework designers, slot them in the expected/correct places and it should work.

  • e.g. Spring is a framework for DI. You write xml files in a format dictated by the designers and then the framework allows you to obtain assembled classes without having to worry about the framework does it.
  • Rails is a framework in Ruby for RAD web-apps. You only write the models, controllers and views and you have a working web app in under an hour.
  • the BCL is a set of class libraries so that you don't have to implement data structures and frequently used types in .NET and just get the tested proven implementations for free by just including them.

A framework usually contains multiple class libraries. As always, the terms are used in an ambiguous manner nowadays.. but the above represents the more common interpretation of the terms... mine atleast :)

Often you use libraries to get a certain functionality in your OWN software/infrastructre. For example printing a barcode, you would use a library to do so. A framework abstracts a whole class of problems, perhaps the problem of writing web applications. To do so the framework delivers the "frame" with all functionality and stubs you can programm against.

you call the code of class library where as framework calls your code

A class library is simply a set of classes encapsulated into a definable unit such as an assembly. The term is not restricted to any particular language or framework.

The Base Class Library (BCL) is a specific term attributes to the set of class libaries that come pre-installed with the .NET Framework which provide classes neatly organized into namespaces so that you have an API against which to build your own solutions.

A framework is a wider term that is inclusive of the class libraries, a virtual machine that manages controlled execution of processes, provides a runtime environment, along with other services such as memory management and exception handling. See the .NET Framework for more information.

I'd argue that the two are fairly interchangeable... - it is simply a set of common re-usable code (in whatever platform you are targetting), usually supplied by the platform.

Maybe you could argue that the BCL usually represents the "pure" (vendor-independent) modules, where-as the "framework" may (depending on how you use the term) include the vendor's bespoke modules. But that it perhaps open to local interpretation.

A framework is an allegedly cohesive collection of one or more class libraries. The Java and .NET frameworks, for example are made up of hundreds of class libraries. In .NET there is, by custom but not necessarily, a correspondence between assemblies and class libraries. In Java there is a rough correspondence between namespaces and class libraries.

Although I have never noticed the phrase "base class library", I would expect such a thing to contain abstract classes intended to be subclassed before use.

Framework in the sense of my first paragraph implies completeness within the purview of the library. For example, you would expect an image manipulation framework to contain everything you need to manipulate images, ranging from file format parsers to in-memory graphics operations.

I think of a framework as a pattern that an application can conform to, defined in a set of libraries.

A "base" class library might mean several things depending on the context; it could refer to classes that are designed to be derived from, which is a common approach in frameworks, or it could merely refer to a core library of classes that are assumed to be useful in any application and so are considered a "basic" need, almost part of the language (for example, container classes).

An application has many parts coexisting in synchronization providing different functionality...now code must be written for each of these parts to work and therefore an Application Framework does that code for you so that you don't have to go through nitty-gritty of writing every code related to every functionality.Application frameworks make writing applications easier.

In most simple terms if you are making a building then its skeleton structure,Shape,functions it can support,electrical and hydraulic design , frames,etc are all its framework and now you must work in that framework to make your building so all the worrying about making a earthquake proof structure or making a linearly erect building has been handled by your framework

It's that simple. The framework takes all the complexities of interfacing with the operating system and simplifies them for you. It handles all the nitty-gritty details for you. Obviously certain frameworks do a better job at it than others.

Difference between Application Framework and Libraries : You use a class library in writing your code, but you code within a framework.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top