APIs and Applications

When I was growing up my brother and I each had a train set.

My brother’s was a Hornby set.  It was very realistic and the trains looked amazing with superb attention to detail.  However, if he wanted a different train for a different purpose he had to buy an additional train – a different model.  Hornby trains are like closed applications.  Very well crafted, good at what they do but not adaptable.

Lego 7745 by Nico Kaiser.  Source Flickr.
Lego 7745 by Nico Kaiser. Source Flickr.

I on the other hand had a Lego 7745.  This beautiful red set was built from the familiar lego bricks.  One minute it could be a sleek, dashing European Inter-city train speeding between Paris and Hamburg.  The next it could be an industrial steam engine (with a much better station!).  Beyond the those two possibilities in the instruction manual that it could be anything I wanted it to be that I could make with the bricks I had to fit together.  This train was not so completely polished but was functional, attractive in different ways and mutable.

I remembered these two train sets when I read Daniel’s post on APIs and his pulling out of the defining feature of APIs as being a “set of functionalities”.

In this analogy a train set is an application (perhaps the tracks are data but I may be pushing it!) and lego bricks are APIs.  APIs can be used in different combinations to build different applications.  To use some UML class terms, an application built with APIs is an aggregate of their functionalities and can be refactored to meet different needs; and application not built with APIs is composed of its functionalities and needs to be replaced to meet different needs.

Advertisements

2 Comments

Add yours →

  1. Lovely analogy Alison! I’m also very jealous of your lego trains – I had lots of lego growing up, but no trains.

    Like

  2. I like the Lego analogy too. It also brings to mind some software that was developed at MIT to help teach children the basics of programming http://scratch.mit.edu/. I’ve always regretted not pursuing this when I was younger, despite some encouragement! Oh well, I have less excuses now so am making a start with some basics…

    Like

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: