The granularity of Abstraction

What is that and why write a blog post about it?

Perhaps because I am convinced after N years1 of architecting all sorts of IT systems this is one of the key feasibility indicators of a well-architected IT system. Namely the level of component granularity.

What is the abstraction materialized in the context of the real IT system? A portal back end, for example. Nothing else but a good old, web service. The best example is REST endpoint URI, representing an abstraction called “a resource” which is in turn implemented as a web service.

In order not to be too abstract, in the following example, we will use an online Phone Book as a Use Case.

What is a large and what is a small abstraction?

The smallest possible abstraction is the one computing  entity which does one thing. And has one method on its one interface to do that one thing.

Example: for a given UID return the name of the person. A single piece of data. For understanding it better, tell me what is the opposite then? The opposite of “doing one thing” might be a component that given UID returns everything available for that person. In that scenario, all the phone numbers, addresses, notes, and such, are associated with than one person. That is certainly more than a single piece of data.

Detour: of course, UID (Unique ID) is the one abstraction utilized above. Well-defined single and simple meaning.

Detour: a single piece of data is materialized in this century, as one key/value pair. For example:

Great. Let’s do this  “one thing” then: architect the system which compares the approach of many components, each with an interface that does one thing with the opposite end of the spectrum: one method.

The many-components approach is also what will give us the greatest possible number of components for a given system to be developed, deployed, fed, and watered.  And each Cloud component is a piece of server-side software. Thus it also has to be implemented, maintained, debugged, etc.

Here is one “sketch” antagonizing these two opposites: each thing as one component vs on component one api returning many data things about one person:

On the left are four arbitrary components as an interface to the proverbial “Phone Book” abstraction, on the right, is the opposite concept: a single component with a single method, to get the whole data about a single person in one go.

Left: a lot of little data pieces flying from the cloud to your front end (aka “browser”). Right: not a lot but large(r) data sets flying from the cloud toward your browser. Ok then. Which one do you prefer?

You prefer the “Right” option. Ok. You represent an opposing force: you want to minimize the number of components. I guess you do not want to create maintenance effort draining your DevOps resources.

But now you take a pause to think. The “Left” option is very tempting because it is flexible. Simply you do not get the data you do not need. You want just a person’s name, and there is a separate component delivering only the person’s name and nothing else but a person’s name. And you do not provoke a lot of large data sets with all the data about one person in one data set, flying around. Allow me to pull you back into reality now.

In the real world of markets, profits, and all those mundane things you do not like to think about (because you are a developer or application architect at best) there is this thing called: Cost.

Yes, it is linear. Instead of one (1), you might have N of everything: teams, deployments, tests, debugging, high visibility maintenance events, and such. And that raises the overall Cost.

I am not advocating one or the other philosophy.  Just dragging you in front of the actual and real picture.

Conclusion

And there you have it: this is the granularity of abstraction explained. Journalists might say: “Truth uncovered”.

Smaller granularity is a more complex interface on fewer components, larger granularity is a simpler interface on each of more components. One granule is the extreme end point of that direction.


1: Where N is a large number

%d bloggers like this: