
Code Textures

No, this is not a typo. This article will not focus on structures, but on textures of program code.
To explain what it is and why this concept is important to me, I will tell you one story.
It was a very long time ago, in the late seventies of the twentieth century. We then programmed one large (for those times) system. The concept of an IDE (Integrated Development Enviropment) did not exist yet and we used the Editor to enter the program code.
The Editor we used had one interesting feature. When loading a file with program text from the disk, he first showed it, "scrolling" on the monitor screen from the first line to the last. The downloadable text ran quickly before my eyes, so it was difficult to parse individual lines at this time.
One morning, my colleague, who was working at the next table, suddenly said loudly: “Oh, what a beauty!” He was not a very emotional person, and therefore we went interestedly to his table to understand the reason for this delight.
It turned out that on the eve he received the task to slightly correct the program written earlier by one of our gurus. For the audience who had gathered behind him, he again turned on the loading of program text from the disk. And lines of program code quickly floated from bottom to top on the screen. But these were completely different textures from dots and dashed lines than those to which we are accustomed. They were full of harmony and some kind of magic. They were really extremely beautiful and literally bewitching. I thought then: “Can such a code be wrong?”
Clearly, maybe. Since then, I looked through, sometimes analyzed, sometimes corrected or wrote millions of lines of program code myself in a variety of programming languages. And in most cases, I was convinced that good programmers produce “beautiful” code and high-quality ones - not just “beautiful”, but also some kind of “optically harmonious”.
However, I have to make a reservation. This rule applies only to manually written code. Generators sometimes produce very structured but error-prone code.
Code Structures and Textures
Well, we almost agreed on the concepts. Unlike the classical structure of the program code, which is defined by dividing it into its component parts and the format of the individual parts, by the texture of the program code we mean its visual representation on the screen.
It is clear that the textures that we saw then in the seventies, or which can be observed today on modern high-resolution monitors, are ultimately a reflection of the structure of the program code.
When it comes to program code structures, programming patterns (patterns) almost automatically come to mind.
In my opinion, the use or non-use of classical programming patterns has little effect on whether the code will turn out to be “beautiful”.
The beauty of the code is influenced by completely different structures. These structures can be divided into several hierarchical levels.
The first level is provided today by well-configured code editors built into the IDE. They automatically trim indents, add forgotten brackets and other characters, and generate correctly formatted code skeletons of standard methods or functions.
The structures of the second level depend on the choice of responsibility for individual program blocks (for example, classes or methods), the implementation of inheritance, and the grouping of small blocks into large ones. It is these second-level structures that decisively affect the texture of the code and its "beauty".
Obviously, the optical beauty of code is not the goal of professional programming. And yet, when I see optically elegant code constructs, I am often tempted to scroll further on the screen and maybe see a couple more nice code textures.
Instead of a conclusion
So what did I want to say with this note? And here is what:
Code structures reflect thought structures.
Code textures display code structures.
Thus: Code textures are one of the materializations of thought.
If the program code turned out optically beautiful, then the creator’s thoughts were elegant. And elegance and thinking style are inalienable signs of high professionalism.
And in the end - my appeal to programmers:
Pay attention and enjoy the beautiful textures of the code, if any. This pleasure is available only to people of our profession.