📜 ⬆️ ⬇️

About "Elegant Objects" and Evangelicals

Software development today is a common profession. There is nothing complicated in programming, except that, as one of my colleagues says, naming variables and problems with caching, everything else is an established process with clearly defined roles and routine operations. Even entering entire blocks of code from the keyboard and some types of refactoring are automated in modern IDEs. And in order to somehow keep oneself fit (after all, sedentary work, lack of physical activity), one has to lift, carry, leaf through, and sometimes even read many volume books. The heavier, the better - especially valued copies containing about or more than a thousand pages.


For myself, I divided useful IT literature into three categories: handicraft, scientific, and agitation. The first one helps to improve the development process, understand some programming language or technology, the second one - to immerse deeply in some task, to understand the basic principles of solving various problems, to form a holistic view of things. These two types are distinguished by a restrained emotional background of the text, a context rich in references to other sources, and thoroughly supported by facts from real successful (or not so) projects describing approaches and methods. Books of the third type are written by evangelists. Recently I happened to read “Elegant Objects” by Egor Bugaenko. Many well-established things that we are accustomed to consider the best practitioners are simply and clearly called evil in the book: getters, setters, ORM, DI containers, and others that seem to facilitate the work of a computer technician.


However, such emotionally saturated texts, if they have a consistent approach (in Elegant Objects, this is a purist view of the PLO), and not just shamanism and hysteria, usually make you think. For example, the same getters and setters always looked suspicious to me. On the one hand, they encapsulate something. On the other hand, all private properties seem to cease to be private. Generally, when I use the IDE to automatically create a set of these methods for the properties of some DTO, I begin to be tormented by doubts about the need for a programmer human layer between the idea of ​​a product and its implementation.


If you come to an unfamiliar city, then you notice some details better than the locals who walk these streets every day. With the customary procedural and imperative approach, we may not quite correctly perceive objects. The author of "Elegant Objects" is very respectful of them, respecting the boundaries of their private property. The main principle - encapsulation, is consistently mentioned throughout the text. All of these clean-glittering clean-glass buildings that look like cleanliness seem alien in a country of industrial software development. And in this sense, the book allows you to look at familiar things with the uncomplicated gaze of a foreigner in an unfamiliar city.


At the same time, it is difficult for me to become a religious fanatic. If the work uses a tool to reduce routine operations in general, speed up the process, I will use it. Especially when this practice has already shown its advantages in the development of a large number of industrial projects. The same IoC container, although it encourages us to treat objects “disrespectfully” by taking away the right of birth from them, at the same time allows us to think less about how we create each object in the system. The task is on the conveyor.


Evangelicals deliberately and fiercely reject the historical context in which their ideas are boiled, and with the storm and the onslaught of dispersing mossy philistines, supporters of getters, setters, DTO, IoC and other well-established formulas and spells. At the same time, we understand that this is most likely a clever trick designed to grab our attention, an attempt to look at seemingly solved problems from the other side. Perhaps even the most vehement supporters of established processes, distracting from the battles in the comments and pipeline programming, will try to solve the problems proposed by the innovators in their home project. For me, this kind of literature is interesting from this side. When I first read the next block of code in the text, I can first appreciate its elegance. Then I will think where it could be applied in the projects I am working on now, how it can improve the process. If the second is not obvious, then the author's belief in his rightness makes me look for a solution to the problem, try to understand why the code is written in one way or another. Thanks to evangelists, programming stops being a chore.


')

Source: https://habr.com/ru/post/334766/


All Articles