📜 ⬆️ ⬇️

Programming in the style of Russian novels



One of the things that makes classic Russian novels so hard to read (for foreigners) is that the main characters have a bunch of names. For example, in the novel " The Brothers Karamazov " one of the characters - Alexei Fedorovich Karamazov (Alexei Fyodorovich Karamazov), which in the course of the text is also called Alyosha, Alyosha, Alyoshenka, Aloshechka, Alekseichik, Lesch and Leshenka (Alyosha, Alyoshka, Alyoshenka, Alyoshechka , Alexeichik, Lyosha and Lyoshenka)

“Programming in the style of Russian novels” is an anti-pattern arising in a situation where one thing has many names. For any program, you may have a path in the version control system, a path on disk, a project name, an executable file name, etc. All of them can have the same (single root) names, or vice versa - each can be called differently. For example, synonymous. Or even in different words. This happened for historical reasons that the foo.exe binary is obtained by compiling the bar project in the baz folder, etc.

')
I thought about all this today when I wrote one program. The same entity has many names. Here we take some number from the program: for it there is a variable (even two - one in the frontend and one in the backend), there is a text field on the form (and another text to it with an explanation), there is a field in the database, there is a field in XML file. In an amicable way, all this should be called in the same style - but if the programmer was inaccurate, or the code was written at different times, by different people, in different programming languages ​​- the variables may well be called differently.

This is “programming in the style of Russian novels”.

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


All Articles