Library vs Framework (was Dr. Dobb's Python-URL!)

Terry Hancock hancock at
Tue Aug 16 17:31:26 CEST 2005

On Tuesday 16 August 2005 08:46 am, Rocco Moretti wrote:
> But I'm not sure if library vs. framework a fair comparison - the two 
> are doing different things. With a framework, you're not really writing 
> your own program, you're customizing someone else's. Sort of a vastly 
> more flexible version of command line options. Saying you can't reuse 
> code written for a framework is kind of like saying that it's difficult 
> to use an Apache config file with the Gimp.

Yeah, well that's precisely the point. They *aren't* the same thing,
and which one do you want to use? :-)

Zope recently started going through some massive changes to make
it more like a toolkit (which is the term I use instead of library here).
Even if there must be a framework, a thin framework with good tools
tends to be better than a complex framework, even if they can, in
principle do the same job.

This is really just another version of the Unix "small tools that do
one thing well" philosophy.  The operating system is the "framework"
that ordinary programs run in -- and you must spend a fair amount
of time learning to use the operating system, which is why it involves
so much buy-in, and people are so religious about which one they
use.  That's a general property of frameworks.

Utility programs are themselves a toolkit.  You don't have to know
all of them, you are free to use some and not others, and you may
use tools from many different authors together.

OTOH, a massive Microsoft-style application is a framework. Instead
of scripting a bunch of LaTeX modules and scripts together to make
a newsletter, you do it all in Word, and maybe write Visual Basic
code to be interpreted by that framework.  I'll probably get flamed
just for mentioning this system, even though I'm not advocating it. ;-)

Similarly, Zope has suffered because there is such a large learning
curve, it's so complicated, most people don't really understand what
it does -- essentially, *because it is a framework*.  That's why, I think,
the developers have been moving towards a more toolkit-oriented
design with Zope 3.  The "component architecture" is an attempt
to do that, by component-izing all of the important functionality
so that it can be used separately.

All of this is also linked heavily with the open-source bazaar-style
development model, too. A toolkit, with tools coming from many
different sources is more like the natural output of the bazaar. A
framework is a cathedral, so it needs a cathedral engineering
approach in order to make it work.  

Where a framework shines is when you don't really want to program
it much at all -- you just need a tweak here and there beyond what
it already does.  Gimp plugins are a great example of that. 


Terry Hancock ( hancock at )
Anansi Spaceworks

More information about the Python-list mailing list