A good architecture is consistent in the sense that, given partial knowledge of the system, one can predict the remainder. - Fred Brooks, Design of Design, pg. 143
I’ve been voraciously reading Design of Design, a new book of essays from Fred Brooks, author of the software engineering classic, The Mythical Man Month. I’ve been enjoying it immensely and would recommend it to all who deal in software. Combine it with a glass of wine, a comfy rocking chair, and relaxing music and life is good.
But, the quote above got me thinking about fractals; a topic I was quite enthralled with in high school. Yes, fractals, bear with me.
When I read that sentence it felt like something I knew was being put into words so simple I could never have achieved. But, if you work in software you know that when looking at a well designed application or API, there are similarities that can be recognized immediately. You become familiar with one portion of the code and it gives you insight into how the whole application works. This is the essence of what becomes described as a beautiful or even elegant design.
It is something I have strived for as I design systems. But this brings me to the fractal topic. One of the key characteristics of fractals is the concept of self-similarity and independence of scale. Basically that as you zoom in or out of a fractal object, it looks the same. The way this is measured is by defining the dimensionality of an object. I won’t go into lots if detail, but the basic idea is that you can have fractional dimensions. A straight line is 1 dimensional and a square is 2 dimensional. But what about the line representing the coastline of a country? It isn’t a straight line, but it isn’t a solid either. And ad you look closer and closer, from orbit all the way down to grains of sand, it basically has the same shape. This is the essence of self similarity Depending on the twists an turns and nooks and crannies, and, yes, the self similarity, it will have a fractional dimension somewhere between 1 and 2.
So how do I get from software to fractals? well it seems to me that if one could represent software, most likely APIs and functions and measure their dimensionality, one could use that as a measure of quality if design. The higher the self similarity of the API, the better a design it might be.
I haven’t looked if this has been thought of before. But who knows, maybe there is a PhD in this idea.
Update: Turns out I was right, it is a PhD level topic: A Fractal Software Complexity Metric Analyser