Fractals in Software Engineering

01 May 2018

When I look at the picture above, I can’t help but feel a sense of awe and admiration at nature, especially its ability to mix various colors, shapes, sizes, and materials into something of beauty. One may get tempted to think all of that beauty is a result of random chances. We just get very lucky that everything turns out fine. This is a very flawed way of thinking because behind the curtain of the scenery above, there is a design pattern that governs how those things are made and placed, which is known as fractals. This design pattern was discovered by Benoît Mandelbrot, a famous American-French-Polish mathematician. One can see the patterns that fractals produce everywhere in nature. The best illustration of this concept is demonstrated in the picture below. The pattern can be observed from someone as small as a leaf to a giant coastline.

Nature teaches us a very important lesson about engineering. In order to create something great, there must be a design pattern in place. Just like there are fractals in nature, there are also ‘fractals’ in software applications.

Fractals, itself, is not a thing. It is just a template for things in nature to be built upon. Similarly, design patterns in software engineering is not a finished design that can be transformed directly into code. It is just simply a description or template for the engineers to build their software upon. There are three basic kinds of the design patterns.

Structural patterns establish a relationship between entities so that they can be easier to manage. Depending on the situation, it can be implemented as class-creation patterns to use inheritance, or object-pattern to introduce objects with new functionality into the program.

Creational patterns mainly focus on class instantiation. Depending on the situation, it can be implemented as class-creation patterns or object-creation patterns.

Behavioral patterns are used to create communications between entities so that they can be easier to communicate and interact with each other.

Of these three available choices, the one I use the most is structural patterns. This is my pattern of choice because it allows me to optimize my code. With one set of code, I can make it perform its main functionality but in various ways. Similar to how root works, although its only job is to deliver nutrients to the body, it is used in different plants to keep them alive.

My wish for the future is to be able to understand thoroughly how other design patterns work and how to implement each one of the correctly into the building process. The closer I am to this goal, the more I will be able to “mix various colors, shapes, sizes, and materials into something of beauty,” becoming the true fractals in software engineering.