📜 ⬆️ ⬇️

Programming vs Patterns

Monday morning. A work colleague asks for a small search query. Half an hour and the request is ready. It does not take five minutes, as a colleague comes up with a couple of conditions. I add conditions. Now he wants more information in the answer. I'm starting to make tables ...


And so is the first half of the day. I work as an interlayer between the employee and the Database - not the best occupation for the programmer. Therefore, I decide to create a program designed to satisfy all sorts of queries without forcing the user to learn SQL. Employee refused with the next request and announced the upcoming program. He liked the idea, but he is concerned about the question " When? ". Yes, I myself do not know when ... A week or two or three ... It will be visible there. Requests an alpha version early. I had to promise to let him drive the first alpha.

I sit. A sheet of paper in front of the keyboard, a pen in hand ... I begin to mull the architecture of the program. I am trying to take into account various aspects of the program, to predict the possible development. After a couple of unsuccessful drawings, something plausible is obtained. Finally ... It's time to code ...

I outline several classes, I write code ... The work is in full swing ... In my heart, dissatisfaction with the resulting architecture matures. I feel how the dependencies between the classes grow and grow ... Programming at the interface level is observed only in 3-5 clearly marked places. I want to take a pen and draw again. But the other half of me says: " Be a man! Write the code and do not complain! You see, I don’t like the architecture. I wrote earlier without OOP principles and everything worked wonderfully ." The employee, meanwhile, is interested in progress in the morning and in the evening. At every meeting I predict the closeness of the outcome. But the code doesn't get any better from this. Rather the opposite.
')
Now conscience does not allow to sit down to draw architecture. Conscience: " If you draw, who will write the code? Yes, it's too late to redo everything! Make it just work. And then do it ... re ... ref ... refactoring! " I give in to this persuasion.

Finally, the program begins to partially function. The employee is partially satisfied, congratulates with an excellent program. This finally drowns out the howls of the soul about the internal imperfection of software. In the meantime, in the process of finalizing the program, changes are made throughout the code, there are no tests ...

And the refactoring stage will never come. A question from the authorities: " What else is R e X a K t O r I N? You said it works! We have many other tasks ... ".

What could be worse than being aware of your problems and being unable to correct them?

PS
It is not me, but one my friend of my friend, who is not my friend at all. And in general, all coincidences with real people are random.

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


All Articles