What exactly constitutes a framework?

chrstrbrts

Senior member
Aug 12, 2014
522
3
81
Hello guys,

I was wondering if anyone has a strict definition for 'framework'.

I read someone's definition somewhere online; he simply said that a software framework is just any pre-written code that can be called out to and utilized by programmers writing code in the future.

By that definition, a simple DLL would be considered a framework.

But, so would the Java Virtual Machine.

There's a hell of a lot of a difference between a simple DLL and the entire JVM.

So, I was wondering what the exact definition for 'software framework' is.

Thanks.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,595
4,498
75
I would disagree with your definition. What you defined is an API.

A framework is a system that either performs some function minimally, or can with minimal changes, which allows expanding its functionality in specific places, but which limits its adaptability outside those places.

I generally prefer an API to a framework. Although my current work is in Drupal, and that framework is generally flexible enough to do whatever I need to do.
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
I doubt there is an exact definition. But here is my best way of pointing out the difference.

A framework is all about dictating the "right" way to do something. Frameworks are intended to rarely be escaped, they provide everything. Generally, a framework will not play nicely with things outside of the framework.

So, for example, Ruby on Rails is very much a framework, you are expected to play entirely in the rails world and escape should be rare/non-existent.

You can generally tell if something is a framework when companies look for an X developer instead of a Language developer. For example "Looking for a wordpress developer" or "Looking for a Grails developer". You won't often see a posting looking for a "Jquery developer" or "Gson developer".

Frameworks surround the application, libraries are surrounded by the application.

In general, I think frameworks of all kinds are a mistake. They may provide a lot of functionality, but they have the big problem of being big. When a framework makes major changes, it can often cause you to need to completely rewrite your application. On the flip side, when a library makes major changes it will often only force you to rewrite a small section of the application (if that, often times library breaking changes don't affect your current usage).
 
  • Like
Reactions: Ken g6

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Another way of looking at it is a framework simplifies development by trading flexibility for a pre-written workflow design with a set of constraints.

An API exposes a set of features but leaves how to combine them entirely up to you.

A framework has you plug in specializations of itself to match your workflow, but it can only bend so far before it either blocks your intentions or forces you to break out of it.

People often tout a framework with a 5-line text editor or something like that. Which seems nice until you realize the built-in document serialization doesn't support a feature you need, or the database query can't be optimized for your use.

I designed four decent-sized applications (hundreds of thousands of lines of code) using Microsoft's old MFC framework for my previous and current employers. MFC was pretty good as long as you accepted its supported ways of building a user interface. Sadly, each of the three apps needed enough customization that I had to ignore MFC's document serialization, ignore dialog data exchange, and mangle the puffin out of the default Single Document Interface UI design. So I used the "classes" part but only scattered bits of the framework.
 

Merad

Platinum Member
May 31, 2010
2,586
19
81
I was wondering if anyone has a strict definition for 'framework'.

Nope, not really. I think you can pretty reasonably say that all frameworks are libraries, but not all libraries are frameworks. The larger the library, the more likely that it would be a framework, IMO. Where's the dividing line? I dunno, and I kind of doubt that you'll find any conclusive definition or agreement.
 
  • Like
Reactions: Ken g6