Refactoring Paintings

Refactoring is a well known technique in software development. In short terms, refactoring is to execute a sequence of small well defined steps with the intention to let your code base more clear, more beautiful, more elegant. The result of a continuous refactoring practice is a simpler and easier to maintain software project. There many times also when refactoring takes the programmer to create new abstractions and code generalizations.

Let’s go to a simple example: suppose we are programming a Person entity class. This class contains attributes like name, weight, age, gender, spoken language. After some time, I find out that I need to insert cats in my system for some reason. Then, I create the Cat class with its attributes name, weight, gender and hair color. After that understand I’ve created an ambiguity. Both and Cat and Person classes have some attributes in common. By doing a refactoring, I can then create the Animal class, with the common attributes (name, weight, gender) and make the Cat and Person classes “inherit” the animal properties.

The idea of extracting abstractions is to identify the essence of a system and describe its most deeply characteristics with simple elements. To achieve this essence you need a lot of experience and sweat. You need mastery you programming skills and use the tools and programming languages in the most proper way. It is an Art.

Play the video bellow to see how refactoring was made by Pablo Picasso in his paintings:

First, the painter draw a ordinary bull, which can be recognized by a 5 year old child. Irrelevants parts are being remove at each new stage of the draw (there are 11 pictures), besides the main idea of the bull remains. The whole genious desconstruction proccess takes six weeks. Even with few drawn lines, the last painting can still clearly represent the bull. They are the animal’s essence.

Every capable programmer, software creator, needs to know how to recognize essential aspects of the domain he is programming for. The technic helps to execute it, but geniality is rooted in intuitive thinking and the artistic capacity of identifying and extracting the essence.

(Portuguese version)

Leave a Reply

Your email address will not be published. Required fields are marked *