Simplicity, beauty and complexity of the software development

Simplicity is the ultimate form of sophistication. Leonardo da Vinci

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery

People use such words as “simplicity”, “beauty” and “complexity” quite a lot. We can hear them during the discussion on significant issues, but the original meaning of these words is rarely clear to those who use them. Mentioned terms are based on the life experience of a particular person and, as a result, everyone interprets them in their own way. I couldn’t find an unambiguous and easy-to-understand interpretation of the terms in the context of software design and development, so the main idea of ​​this article is to identify these words and to show the connection between them. However, I’d like to make some conclusions  in order of solving the problems.

Complexity. Complexity is an inherent feature of the software. Managing the complexity is one of the most important problems in software outlining the process. “Software projects rarely fail for technical reasons. Mainly the failure is attributable to an inadequate requirements formulation, incorrect planning or ineffective management. If the failure is caused by a technical root, it is often uncontrollable complexity. In other words, the application had become so complex that developers lost sight of what it does.” [1]

Complexity is a measure of structure. You shouldn’t confuse it with the “difficulty” – the amount of work, the effort to implement the task. The task can be difficult, but not challenging. An objective characteristic of complexity is the quantity – the number of system objects, links, states, etc. [2] Complexity is directly related to the cognitive abilities of a person. We always consider the complexity in the context of the subject who is dealing with it. If you say: “This task is complicated,” – it is complex primarily for you. However, people have different mental abilities and possess different skill sets. The solution of the quadratic equation is not a big problem for a student, but it is a difficult, even an intractable task, for a kid. Therefore, dealing with practical software development  tasks, we should think about those ones who solve these problems and those who use the result of the work. In the case of software systems, these ones are users of the system for which the logic of the system and the interface should be as transparent as possible. Yet data processing, algorithms or domain models can be complex for system developers. The more expert user, the more complex the interface can be. The more experienced the developer, the more likely he will cope with the difficult task. However, in any of these cases, the principle applies:

MORE → SOPHISTICATED

Numerous experiments show that the amount of attention, the number of dissimilar objects simultaneously perceived by a person is limited and varies between 4 and 6 [15]. You can base on these numbers to determine what is complex ащк understanding. For example, if the diagram contains about 4 elements, it is easy to perceive and understand. A dozen elements will be difficult to perceive. Obviously, you will need to spend much more time to understand an object that contains more than 15 elements.

The same approach can be applied while creating program objects.

In the context of human cognitive abilities, it is worth remembering the Kolmogorov’s complexity [4]. It describes the size of the text that can define the task. The larger it is, the more difficult it is to understand. If we talk about software systems, this concept can be transferred to the total amount of the software system’s code. In other words, complexity is the amount of information that must be perceived by a person in order to understand a system or object.

Beauty. The concept of beauty is inseparably connected with the aesthetic feelings that a person has towards an object. Emotions appeared in mammals’ brains during the evolution as a reaction to the external environment to improve the survival rate of the species. Emotions are an unconscious brain’s response to external information, and they are directly related to the activity of the cerebral cortex.

The brain processes and generalizes huge data sets coming from the senses. Basically, the cortex consists of several layers. On transferring the information from layer to layer, the data is generalized, activating highest-level neurons that store invariant data and abstractions. One of the main functions of the cortex is a prognostic function based on the memory of previous events [8].

Aesthetic feelings are the reaction of the brain to understand the dependencies and structures – the ability to predict. If the expectations of a person are justified, the brain produces hormones and causes a positive emotional reaction [10].

Such concepts as harmony, symmetry, the proportion of parts marched hand in hand with the notion of beauty throughout time [9]. An engineer’s scientific activity goal in the domain analysis for the software development is the next:

a) Classification of entities.

b) Search for components dependencies.

c) Determination of structural components and their order.

The simpler the complex domain model is set, the more “beautiful” it is, the more aesthetically significant. The formula for the beauty of scientific discovery is written in the article “The Beauty of Science” [5]. I think it can be applied for the evaluation of technical solutions – any technical solution is a consequence of analysis, the elaboration of the domain.

Aesthetic significance (beauty) = Observed complexity / Scope of model description.

Or, in other words, beauty is a structured and visible complexity.

There were conducted psychological experiments in which people were offered to choose the most attractive rectangle from the submitted group. In most cases, the subjects selected the so-called “golden rectangle” which sides were in proportion to the “golden section”, so that means the sides were properly arranged [12].

Furthermore, the people’s attitude to the graphic fractals representation supports this point of view. Fractal is a very difficult structure, but in this system organization, a person can see a symmetric order and, as a result, he experiences aesthetic feelings [13].

However, the subjectivity of beauty appears from this. Interrelationships and the structure model can be acknowledged only through certain cognition capacity and experience. Only a professional (or, more accurately, a person with a certain level of cognition capacity) can see the beauty in solving a problem and experience aesthetic feelings. The person must be a mathematician to feel the beauty of a mathematical formula, otherwise, the formula is simply an incomprehensible set of symbols. Beauty and aesthetic feelings in relation to the problem being solved is an intuitive measure of the solution correctness.

Simplicity. Human beings think in abstractions, which allows our brains to discover the surrounding world. An abstraction exists in one’s mind as a concept. It is a conversation that allows you to convey information about abstraction to another person. That is why terminology is so important for communication with other people. For example, in an announcement for sale, the word “house” will mean the “structure” of a certain area and value, but in the letter of a person living in another country, the word “house” will mean territory, close people, emotional attachment. The concept of simplicity cannot be separated from the abstraction associated with the object. For a builder, the abstraction “house” will contain much more information than for a realtor. Simplicity is an antipode of complexity: the fewer functions and attributes an object has, the simpler it is.

Language is a means of human thinking. When giving the name to an object, a person determines the abstraction that will be associated with this object. Abstraction allows you to discard all refinements, specifics, details of the structure of an object. We can take the example of the concept of a “mobile phone”. That includes a complex mechanism, dozens of scientific discoveries, years of research and engineering work, but, nevertheless, it is widely used by most people.

All the foregoing applies to any terms. Even the simplest objects, with an increase of the details number, become complex, consisting of millions parts and links. However, in order to use an object with a complex internal structure and talk about it, a person has no need to know all the details of the implementation. It is enough to understand the function that it performs. For example, the phone – to call, the car – to go, etc. In this case, the object becomes easy to perceive that means it’s simple.

Therefore – simplicity is a complexity hidden behind the abstraction.

PRACTICAL CONSEQUENCES

Technical

The basis of the software development is the construction of a domain model.

The most important part of the domain model building is terminology. Using the clear, consistent and understandable terminology is the basis of a successful project. The construction of terminology is necessary to identify classes and objects. “Data dictionary is the central repository of system-related abstractions” [7], and software is created exactly on the basis of abstractions. If you cannot name something, or the essence of the term is vague and ambiguous, it means you don’t understand the purpose of this entity, component, class or method. You should examine the dictionary and come up with an unambiguous clear name. Creating a vocabulary of the domain is the ground of the methodology of Domain-Driven Design (DDD) by Eric Evans [6]. Returning to the subject of the article, the correct term is a good abstraction, simplification. And it’s exactly what we should strive for in creating a software system.

One of the methods of constructing a domain model is the creating various diagrams, graphical representations, and patterns. If the graphical representation is not beautiful (symmetric, structured, with a clearly visible structure) at this stage, then the software implemented on the basis of this model will not work in a proper way, or you will get problems while modifying it. Alter the model if it is not beautiful. If you can’t do this, then, likely, there are problems in your understanding of the domain. Either the model contains entities from different levels of abstraction. Anyway, this workflow shows you the possibility to improve something.

Social

The beauty of the solution can be understood only by a person with a sufficient level of knowledge, qualifications, experience. In your daily life, you can apply this rule as a relative assessment of the knowledge of people who you communicate with. A person with the same level of knowledge as you will experience the same feelings as you do. For a more skilled person, the observed complexity range may seem to be too short, but the profane won’t be able to evaluate the solution itself (model description).

People who tackle the problem must meet the requirements of the complexity of the problem being solved, otherwise, the solution will be expensive to develop and maintain, errors will often occur, or the problem will not be solved at all [3].

Aesthetic feelings are an intuitive marker of the correctness of the solution. Looking for the best solution you should pay attention to your feelings [11].

Conclusion

“Designing is not deterministic. The main aspect of designing quality software is the skillful application of a set of effective heuristic principles.” [1]. This article proposes some principles to provide a better understanding of a task to the developer. The basis for creating quality programs is analysis: the definition of abstractions of the domain, the classification of abstractions and relationships. Define the abstraction fixes the vocabulary of the domain and its correct use. Classify the abstraction and interact with the intuitive sense of beauty, which is inextricably linked with the experience and knowledge of the developer. The ultimate goal of the software developer is to create a system consisting of a small number of extremely simple components (modules with high cohesion [14]) and a minimal amount of connections between components.

When creating individual components, you should follow the same rules as while creating the entire system.

The organizational conclusion: consider the level of workers’ knowledge and abilities when choosing them to solve the problems.

 

Literature

  1. Steven C. McConnell, Code complete.
  2. George_M._WhitesidesToward a science of simplicity.
  3. Igor Tkachev, The Law of conservation the complexity.
  4. https://en.wikipedia.org/wiki/Kolmogorov_complexity
  5. M.V. Volkenshtein,  Beauty of science.
  6. Eric Evans, Domain-Driven Design. Tackling Complexity in the Heart of Software (DDD).
  7. Grady Booch, Object-Oriented Analysis and Design with Applications
  8. Jeff Hawkins with Sandra Blakeslee, On intelligence
  9. Umberto Eco, Storia della bellezza
  10. https://en.wikipedia.org/wiki/Emotion
  11. Malcolm Gladwell, Blink: The Power of Thinking Without Thinking
  12. Robert Prechter,The Elliott Wave Theorist
  13. https://en.wikipedia.org/wiki/Fractal
  14. https://en.wikipedia.org/wiki/Cohesion_(computer_science)
  15. Volume of attention