Tech Is Hard

Credibility = Talent x Years of experience + Proven hardcore accomplishment

Libraries and Frameworks


“Framework” and “library”.  There is confusion. Definitions.

A library is a collection of (hopefully) related software artifacts which can be inserted into an application’s code at any level of granularity or application-specificity.  You might have a database library, a UI library, a stock market library or a library of your own classes.  Libraries take many forms of implementation; source code might be copied via an included file, linked into an executable module (no library source code) or in the form of remote calls.  A library is usually designed for a single area of use.  You can use hundreds of libraries.  It is relatively easy to replace a library, if the application has low coupling and high cohesion.  If it’s not easy, then the application could have been designed better. (I’d like to find a word that implies good “layering” of functionality.)

(That’s a pretty good measure of the system’s design: how easy is the system to live with? Is it made to evolve without duplication of code?)

A framework, short for “application framework”, is something within which you construct pieces of an application.  If Yii is an example, when you use an application framework, the framework is the application.  The custom code mostly supplies exit points that define configuration states. What gets called when you hit a Yii app?  Yii does, not your code.  It takes over right from the start.

A framework can’t be replaced at will.  The custom code is actually implementing a large number of interfaces that will all be different in a different framework.  How “quickly” could the actual application code be extricated from the framework code?  Business domain knowledge is scattered and duplicated in different modules because it is conforming to someone else’s idea of architecture, and since that doesn’t map to any domain model, you have to be ultra-disciplined to obtain any cohesion.  Every reference to a framework entity in code, e.g. Yii::app(), is a global reference, and raises the coupling and cost of this system.

A framework constrains, by its very name; the frame of something circumscribes its shape and size. You don’t have to check anything out from a library, though.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: