Andrei Aksenov shares difficulties in preparing slides for the report.This is a transcript of the Highload ++ performance.
')
If you see this slide - I didn’t have time for the pictures. Bunin came, made sure that the speaker did not disappear and asked a mean question. We are preparing a conference in advance, receiving reports on September 1st. I also wanted to prepare in advance. Yesterday at 6 pm I began to draw slides for another report, and for this at 11, so that's it.
You have to make a clean stand-up - and listen with your ear, but this is probably for the best, because you can safely blunt the phone.
What does pure stand-up mean? There is no code at all, I specifically tried to minimize the number of lines of code in the presentation, although the pair still leaked. No revolutionary considerations on any topic. Well, pure bydlyatsky humor.
Perhaps this is a federal crime and the FSB will sweep me right after I leave the stage. Take a chance, at the same time I will get acquainted, let's go.
What is the report about?
On the one hand, it’s about bad code and bad architecture. Because it inspired the idea to make a report about bad code and bad architecture, at the moment when I read the forum post with the question: “how is the quality audit and review code organized in your company?”.
Good question
We do not know the code is good, the code is bad. This architecture is still incomprehensible, all the more. At the moment when we do not check it. Does anyone code checks? Does anyone look at the code? Or purely write only? Or I went to hell, and almost everyone here writes on Perl, except for these two. They are old-school and write sendmail.cf, and with their hands. All other exclusively write only languages, nobody reads read languages. Or does someone still review'it?
Quite a large percentage of coverage. The rest either do not review, or do not burn. Maybe I got to a very depressive forum in which only a Russian person, who if happy, then thumps and writes nothing. And if unhappy, then share his pain with everyone. Therefore, all the reviews here are. Review never seen a career, at best, there is CI, there are tests. Why review code to watch? Nobody is watching him in his own team, and it’s expensive and there’s no time. And if the company is large, then that someone from the other team looked at the code of the other team, so it is generally impossible.
The most captive feedback, because funny. This is the last, like everything is there, all the technical means, a lot of keywords. Many of them I did not hear at all, and if I heard about some, then they cost as much as I do not earn in life, probably.
Everything seems to be there, but there is no happiness. All the same, continuous shit. One of two things, either there is no happiness anywhere, or the happy ones on the forum do not write. Are there any happy ones? Like, yes, you implemented code review, we have perfect code and perfect architecture. One happy person. The rest either have nothing to boast of, or it is embarrassing if such a minor key is chosen. It can not be. I do not believe .
I believe in the fact that somewhere in nature there are still mega-projects with good code, we can be not perfect, but good and perfect architecture.
It is necessary to set a high bar. Does anyone know of good projects with perfect code and impeccable architecture?
Let's top 3. We all know a certain top 3. Favorite Pokemon, bad topic, I do not know anyone. Pikachu pokemon? Who knows? And about the Pokemon one. We build the internal list. Nginx, yet? Any other hypotheses?
You can work with this, but you need a certain correction: the fourth version of the Sphinx. I started writing the third, it is not publicly available, but it really exists, I can get a laptop and show it there.
In general, I tried to come up with projects, but I set myself not at all achievable bar called " let's have the perfect code and a completely flawless architecture ."
I managed to recall several projects, which, of course, was not one of those I had worked on, it would have been too good, looking at which “Wah! Boars wrote. I remembered, frankly, one and more, just in case, plus because, again, lazy and at the last second I did not prepare to revise this code today, and not to denigrate such childhood memories twenty years ago, when I read the Doom source, Quake'a and so on. The only approximation to the list called “somewhere in nature is probably a cool code, impeccable architecture, la la la three rubles”. As an approximation, I can probably cite the source code of the old ID Software, such as personal professional accentuation or the sin of youth, how to name it, but as if I don’t even feel like a technical opportunity to add to the mega list.
True, there was a hypothesis about nginx.
Is there Sysoev in the hall ? Not scorched.
Are there any nginx's in the hall ? Again, not scorching.
Well, I’ll just ask you to comment, do you agree that in nginx you have the perfect code and impeccable architecture? No more.
The question, of course, is somewhat holivaric on whether there is an immaculate code in nature, an ideal architecture and, at least, good codes, good architecture so that it does not feel sick.
But again, it seems to me that, on average, we know these three projects.
And of course IDTech, but that was 20 years ago. Remember all those times, when 286 computer, VR1 helmet and resolution 320x200 and Doom source codes and you kind of read them and don’t know with which hand you study whose code: with your left hand you study the pocket, with the other abrash and you pray for these two gods. More such revelations from the code in life did not occur. Moreover, if you ponder over a complex question called “where did we see the perfect code and good architecture?”. And remember about your own pet-projects, to hell with them with the workers, as if you were not to blame, you are probably alone there.
Programmers by the way are interesting people, and I including damn it. A normal person has a hobby: he works as a security guard, and a hobby is drinking vodka, well, norms, in principle, this is my retirement plan. A programmer he has a project at work, and he comes at home at a hobby and also cuts something. And sometimes it happens so in gamedev'e it was everywhere that the dude wrote the engine at work, but at work he wrote shit, he knows it, the whole team knows it, and even the producer who finances all this from the publisher about something a little guesses, but to turn back already there is no slightest possibility. But how he breaks it done and from the fact that he writes shit, he comes home and writes that? That's right - the engine for the game, but at best for the other. No kidding, in gamedev'e for some reason, such a thing called "something I miss at work, I write on technology A in the afternoon, and I come home writing on technology B". She was decidedly not common.
People who wrote the engine during the day wrote the engine in the evening, some even wrote a little on weekends. In WebDev'e, the situation is somewhat less depressing, but nevertheless in a personal pet-project, I think, too, not everyone will have the audacity to say that everything is fine. The overwhelming majority, maybe just a projection of such a half-objection, not a correct projection, it seems to me, it looks like this.
How is that? It happens so clear from where. The inevitable way of life, which is due to the fact that a person is born completely without brains, then his brain volume gradually increases and completely without knowledge in these brains, and accordingly must go through several stages of filling these brains.
In order for something to work with a specific thing, be it a programming language, a new cool technology, or at least the ability to paint fences with a brush. Inevitably, you go through 3 standard stages: I don’t know how to “dig”, learned to “dig” and feel an inner lift from the fact that “yes and yes, I have mastered the new mega-technology, now I can“ dig ”, I’m the best in the world, all the lights are on me” . And at that moment when you have studied all this you can do everything with this shovel: draw a picture, build a cathedral, whatever.
After studying the second technology, the third and even the tenth, it becomes clear that you can still not "dig." This is an important point I would like to draw attention to it. It happens that, thank God, it’s not polls that people are fixed in their development at the stage, I can “dig”. I can write naturally on C without crosses, so as not to hurt anyone strongly, that's all. I can write C, I can’t write C ++, but I don’t want to look at other languages, I’ll always write C as C, even if the party forces you, and C compilers will die all, they will have to go to some hated company where everything is written in java, I will write on it as in C, destroy objects with my hand. Well I used to, I like it.
At the end of all overtakes death. To my personal deep misfortune, death overtakes everyone too late, a little less than all can, with two exceptions, such as karmak and abrash. During that time, while death has not yet caught up with people, they manage to write some code, and some even design the architecture.
The second important moment causing the fact that you are on the rise, you are about-th, you have been given a shovel in hand, now we will live out of this shovel. At the moment when you have such a shovel, you even when a new one appeared somehow not with your hand to think about how it is necessary. The first step called “damn, to sit would think that it is possible not to dig a hole here with a shovel, we were nevertheless asked to make a pillar”. If we dug a 100x100 pit, we will erect such a burial ground, respectively, 100x100, not exactly according to the TK. Thoughts about this do not arise, we have just been given a shovel, God forbid, give such a person an excavator in hand. Even less often, it is brought to life in the mind, even if it suddenly flashes in a dull head. And of course, even if it suddenly flashed and reached the stage “we don’t still try to make it come to life,” it never reaches the end. Excuses are absolutely standard - it is always long, always expensive, and why do it at all, anyway, and so will do. And as if this well-known book, here there should have been a picture about “herak, herak and in production”.
Well, motivational speaker, the second day, already an afternoon zone, I understandably cannot talk about C ++ at the moment. I can only work as a motivational speaker.
The problem is exactly one, well, ok convinced that we are starting to write cool. Straight tomorrow I will come and start writing cool or even come home tonight and start there. And tomorrow at work about the first, how to continue. One small problem, a skill called “let's write cool”, is like this, is not defined on the one hand, and is not common on the other. There are no general rules, following which you would be considered a worthy member of a programmer society that writes a good clear or even perfect code. I do not know what to compare with. If you wash at least once a week and you change your socks every two days, then this is already a normal member of society. They don't shy away from you and they don't stink very much from you. You follow simple rules and in the social part everything will be fine. No, there are no such rules at all. There are no simple, computable metrics that would not just cut off some unimportant moments, but make sure that everything is fine with architecture. And there are no tools to understand this, there is no automated verification. And the holy bible either. I do not know how one should look from the point of view of applications to develop.
Imagine for a moment, there is a holy bible. Personally, the god gave the ten commandments: do not kill, do not steal, and of course do not use singleton'ami. Does a person use singleton, orthodox or muslim? Is it time to him on the fire? Immediately cross wars, fires and all is well. Within each specific group. Orthodox on the left, Muslims on the right, Buddhists on top gazing melancholically and spitting cherries from cherries. Within each social group that externally successfully given cool commandments, such as the holy bible. In principle, everything is fine, sometimes of course the war with another social group. So that's all right. But unfortunately this is not. Or if there is, then it is very fragmented. Too many groups, and each group is small.
Since no one has given us anything like this outside, we can come up with it cool ourselves and try to build it the most cool. Build the very ideal code and the perfect architecture.
How to achieve this?What is good? I do not know what is good, really do not know.
What can I do? This is to try to determine it.
Here is a funny quote to the topic from the project manager.
There is such a Zen definition. What is good is when it is not bad. That is, when bad, it is not good.
I do not fry at the stake, on the one hand, this is no longer bad, but not necessarily from this good.
At the moment when we have a definition better than it means so that's good, and the rest is not, in fact, if you think about it and be a little bit, then most likely it cannot.
Let's at least in the absence of better, do not do badly.
For especially corrosive readers who prepared in advance for the conference, there are those, at least one. Who read the abstract in which it was written about the ideal code, which is simple, elegant, self-documented. Theoretically, in inanimate nature there is, probably, in the books of Knut and is written in a little-known language mix, literal programming. Everything there was originally invented in order to be self-documented. Unmistakable, of course. Find Knut's mistake, he's been looking for them for 40 years. One problem with it is that this code never exists in principle, except for Knuth’s book. There is written exactly one production program written.
In any case, this is not a constructive definition, they say, write simply, elegantly, self-documented, etc. Advised, thank you captain.
It is also difficult to constructively define an ideal architecture. That is, the thought stops at about the classical metric wtf / min. Further, this is one dream so that you naturally would not put the microphone around qbicle to this wtf / min and not tie your annual bonus to wtf / min. Here, interesting political games immediately begin, you can run around, run up to someone else’s door and yell wtf many times and the annual bonus is cut off to the enemy. It would be interesting from the point of view of team building, but not that.
What is the perfect code? Does anyone know?
I do not know, I tried to think, but as usual I did not. But in the first approximation, it turned out that the ideal code is a code that is at least immediately clear, preferably all. You can not all, but immediately clear.
And the perfect architecture ? Here I wanted to write a lot of words, on the subject of the fact that it is very different. At the expense of immediately clear, I immediately had doubts. The architecture, which is immediately clear to the average person, who can hold about 7 things in his head, and the eighth is lost. As is known from the joke, three balls, the second was not immediately. At the same time, it is quite strange to demand from architecture that it is all clear at once for a minimally large project, at least longer than 200 lines.
Therefore, I came to the conclusion that the key requirement for a more or less good architecture, I personally have one. So that it does not interfere. Because bad architecture is what I can articulate right away. Step left there count, step right guillotine, step north-east there, seemingly safe places, actually tried to foot, there is a swamp, inside the cave, and under it dragons live.
Some kind of horror. Why is that? Why such strange conclusions, called "immediately clear and does not interfere"?
Because the average working day of a programmer without meetings is arranged like this:
With meetings, blue is replaced by meetings.
Do not think that managers live better. The fact is that the manager’s working day is arranged like this: everything is flooded with blue, the legend is meetings, and I want to write code. This is the manager who left the programmer out. It is clear that the task of any normally programmer in this difficult situation is faster, more efficient, more fun to pick up govnokod and throw 10-20-30 tons of angle behind the wall. Then at the end you die and Stakhanov Street is named in your honor. Not.
The goal is to drink more coffee. Because lunch is very long impossible. And you can drink coffee forever. To do this, you need to increase personal efficiency and reduce picking govnokoda, because by skipping you still will not be released from work. For this, it is necessary to arrange this code in such a way, at least around yourself, not necessarily in the whole project. To this this valiant code picked faster.
What operations we usually perform when picking govnokod?
You sit and think what to do. Approximately 90-99% is spent not on writing a new cool code, from which the glow starts to emanate, and the company will earn the first trillion. It takes 90-99% of the time to figure out this code. And there is a lot of it, find a mistake or find a place where you need to make changes or something else in this repository and make the necessary changes. Unfortunately, the good old-fashioned anecdote about a blow with a hammer one ruble knowing where to 99 rubles. He before the invention of programmers was quite relevant, with the invention of programmers and in general. Hammer blows are very funny. I remember cool achivki under the name “I have bravely researched something for two weeks, caught the bug, conducted experiments, wrote kilometer logs”, exhaust one line in the negative. After that, the freak disappears.
To speed up these fascinating archaeological punishments, I would like to do two things. First, stupidly faster to read locally. There is a certain sheet, depending on who has the reading speed, monitor size and other attributes, different context. That piece of code that you are working with now, you want to be able to quickly read and more or less understand it.
But this unfortunately does not always affect the overall architecture of the application globally, we have 300 megabytes of code that is wrapped in microservices. We have a part of chasing under Windows, because it is there that certain proprietary software, around it some kind of wrapper on .net, and it gives data on http, json, a million keywords. Emc is a small part of the stack, we also have cool production servers, on solaris. Why on it? Because admins really like to profile, but programmers can not sell so that we kill this solaris. A stack can be a big one, a common stack, a common project, etc. The local context is always quite small, otherwise it just does not fit in the head. I don’t want to keep the context in my head, I cannot remember either 20 megabytes of project code, 2 gigabytes of project code, not even 200 kilobytes of the current module code, I don’t want to remember, I want to know how to dive into them, instantly understand and emerge.
This is affected by a simple list of 4 pieces:
,
naming
, , , 30
, , , , .
To stupidly quickly understand how it is globally arranged and what is the place of this piece of code in the global big project at 20-300-5000 megabytes of source code, we suddenly bite in the ass architecture. We have a completely different set of requirements.
After all, architecture is not just a line of code. Architecture is classes, these are entities, perhaps super-entities in the form of entire systems, clusters, and connections between them. Therefore, in order to understand what is happening in this, we all need to have it properly decorated, normally named, written out quite compactly so that this sheet can be read in a reasonable time and at least a little commented out.
The moment is again holivarny. Someone at this moment to have emotions, wait a minute, there can be no perfect code, impeccable architecture. What does he carry? Design, naming, compactness and comments. This is a kindergarten. It is primitive. It may not be too easy. The set of primitive requirements is erroneously extended to the code, at the micro level and on the architecture of the whole row, at the macro level.
It sounds completely unfashionable, we are silent that the set of necessary words, extreme programming, the correct architecture. No fashionable architectural innovations, some basic pieces. It is completely unacceptable for 2016, there is no machine learning, deep machine learning, no neural networks. It is not clear why buy a new NVIDIA machine for 130 thousand dollars, so that neural networks can quickly learn. It can not be too easy. To hell with it with your code, the code is something so mundane, uninteresting.
Let's talk about architecture. It can not be that everything is so simple with architecture. Be sure to at least need a design patterns, be sure to follow the SOLID principles, GRASP principles, without TDD, CI is not CI. Agile in its pure form inside is quite difficult, so they introduce one or another set of agile practices, here is a piece of kanban, here is a piece of another process, etc.
We are silent about any esoteric principles about which some have heard, and some even try to apply. No one can call a class that is er or or. This principle sometimes works. With this, I even partially agree, to call the helper class is not good, a garbage dump is formed there, there is an addition to the principle on the one hand, and a formal cheat code on the other. You call the class helper, they instantly catch you on this, they find it through a search and they urgently renamed it. At this point, a misc class or utility class appears.
In terms of unification, I would suggest calling these the TMM class (here is my grave), but probably it won't work. Obviously, the mass of complex principles came up with humanity. Without teams of architects anywhere.
Who remembers what SOLID is? Show up. You do not need the next slide, which says what it means. You remember it by heart, well done! I remember only the letter L, everything else is written off from Wikipedia. Let's be frank, I remember the letter L, not constantly because I consciously follow the letter L constantly in my life. The principle itself is correct, that the heir of the class should not be surprised when you stick it in the place where the base class was expected, but let's be frank. The principle was remembered for another reason, because Liskov is a famous man named Barbara, not yet a man. But how long is the American Liskov, not Liskov? This is the only reason why I remember the name of this principle.
In addition to the mass of principles under the general umbrella SOLID, in addition to the mass of principles under the general umbrella GRASP, in addition to the mass of principles about patterns, visitor's, singletones, factories. In C ++, there is a cool bugbag, simply because in C ++ it is not particularly joyfully sawed under the name: double dispatching or dynamic dispatching. This is just about organizing code, and this is just about object-oriented design.
The code is not limited to object-oriented code, there are still a lot of great great words. About the functional, about the actor model, about the programming model, when everything is asynchronous and completely incomprehensible which of the 17 stitched callbacks at which time is called, but somehow everything works. Until the last programmer on NodeJS and goes to Go.
In addition, this is all due not only at the code level. Architecture is not only the level of code, it is also the level of construction of the system itself. Also a lot of any principles. On the one hand, a lot of keywords, without them, everything seems unfashionable, unextendable, unsupported.
How do we write a graphic editor without a factory of graphic objects? I do not know, without a double factory anywhere. At the moment when it comes to writing code, the head swells a little. But we are programmers, we like to automate everything. We should have tulza, they certainly are. Depending on which language in the yard, they are either more or less.
What do we want from these tools? In the framework of simple requirements, under the name we want a normal design, normal names, compact, commented out, etc. and so the car watched it herself.
What is on this subject?
There is almost nothing. In the C ++ world, I’m an old believer and I don’t know how to write in all other languages. I know a little about C ++. In the world of C ++, by 2016, formatting won not so long ago, for some reason, with the efforts of Apple. Writing first lvm, then a hose, then clang-format.
With all the other points some pop.
Naming - a keen eye and a personal sense of taste.
Compact code- There are no automated check tools either, you can come up with some kind of automated metrics. Conventionally, there is such a cyclomatic complexity, here are so many lines of code for such a user story. Some other strange things. But an automatic tool that just like a neighbor, programmer Vasya would look at the code and say: why did you write these two pages to a deer? You see helper, there are 3000 lines in total. Why did we do this helper, then everything is there, for you did.
The trouble with the compactness, the trouble with the naming machine, has not yet learned to check the machine gun, although the successes of neural networks on the basis of text analysis are inspired. There is a risk that in 5 years we will drive the name of the identifiers through the neural network, and it will either be a green eye, or red wink and you can talk or not.
I don’t hope so with the comments. I do not hope for the adequacy of comments in the codebase. Maybe someday artificial intelligence will grow, look at us and destroy everyone. But I do not live to see it.
Purely theoretically, some tools to build in order to analyze at least the general correspondence of the naming of classes, methods, functions, variables, etc. on the one hand, just at least by the rule of the English language, it can be done.
To make it compact, at least catch certain anti-patterns in the code too.
With comments only a keen eye.
As usual?
Registration happens at all, because gradually everyone has grown to the stage that you need to write normally, and then it’s impossible to read at all. Everything else is all the same.
What is architecture? Perfect or just good.
I consider two schools of thought.
School of thought number 1. Architecture is a giant ivory castle hovering on a cloud, which has no cool keywords, no all principles, moreover for the spec. People who, not only to monitor compliance, as well as sit on a cloud and drop valuable instructions from an ivory tower, down to slaves, black monkeys, this is absolutely impossible.
Perhaps this model works well in Mumbai, Delhi, etc. But in the case when more intelligent developers want exactly the opposite and it does not work.
Option 2 . My current worldview is much simpler. And let's make a simple, code style, design, naming, comments, etc. After that, one of two things. Or in the course of planting a simple you will learn well, and the architecture from this will improve, and the rest will follow. Or this will not happen. Even if this does not happen, at least you have a bad architecture, but inside this architecture there is a beautiful, well-read, clearly designed code.
As I immediately promised, no revolution and breakthroughs in scientific and philosophical thought happened.
Therefore, the grandfather with a beard looks at us judgingly.
There will be no happiness. Ideal codes and ideal architecture from above will not lower. Even if they hire a special architect, nothing will happen. Life is a pain, in the code it is always shit. The only thing we can do with this is to put the practice on among each specific programmer, under the uncomplicated name: I see shit, wash off. Details on the slide.
It is necessary to see a cant in the code, not to ignore it, but to immediately distract and correct, or at least create a ticket, about what should be corrected sometime. Sometimes, it is still a hotel interesting pain, here I’m sure everyone will share stories that evil bosses never give time to refactor, to pay off technical debt, to learn new technologies, etc. Come like this, from under the floor. It will not give. Since such cases then the super-architect, who comes and brings order, will ensure entry into the European Union, it also will not give money and even more so. Somehow we have to do it ourselves, which is important, we must do it all the time. This is my eternal pain, under the name of seizures, I know how to tell and beautiful, but in a manner that is methodical and every day, and every first line is not. It is not easy, it is hard. It could seem,that the so-called “simple” we have at least 50% of everything, or even 90% according to internal estimates. Not really.
Bring a wad of money, bring examples of your code, sit, laugh - let's sort it out.
In a typical case, the maximum in what I believe is the presence of a code-style, and even then with certain reservations. Not the fact that there is a formal document, not the fact that this document is relevant, especially not the fact that automatic checks or automatic forcing, automatic reformatting are implemented.
Comments are the eternal pain of any programmers. Worse than comments - this is only documentation.
One problem . If this documentation is our method to give a shit to the user, that is, when we write bad documentation, this is it, we can express our well-deserved hatred. When we write bad comments, then we take it easy. It is unpleasant, especially when to himself, twice as unpleasant.
Here the position is simple . If they are such better than them do not write. Let there be nothing at all, than this trivial garbage, which in addition breaks.
I will share my personal misery, you can automatically check the number of comments, but you cannot check the quality, you need a living person who will read, and that is a long time and no time.
Compactness. I will give the first example that came right into my soul. It looks like this:
Normal code, all these are written and I wrote this. There is nothing ashamed about it. Moreover, this most fascinating code, which does something there, some cycles, surfaces, is not clear. It can be precisely in this form to be historically conditioned. He should have been like this if there were 20 checks inside and then they were reduced to one. One problem. I would like to see one line in the place of this hell:
I specifically wrote it with an incorrect syntax that does not compile.
I repeat in C ++ you can get closer to the ideal, because the 11th C ++ gives you some lambda and you can pass the lambda function there, define the argument, it will be a little longer, on the floor line.
But even on a poor C ++ 0.3 without any lambdas you can write in two lines, as at the bottom of the slide. Even in the old C ++ you can write much more compactly than it was.
I have these 3 lines, and ideally 1 is much faster at times. If you do this with each line, then the reading of the code as a whole will improve significantly.
It is useful to do it simply on any floor, even if it doesn’t grow miraculously or by personal efforts or a specially trained and hired architect, some mega architecture is above and still constantly beat the back of the head with a bat, then at least every minute work with blunt code on the first floor which under all this architecture lies.
After the introduction of certain simple hygienic practices about registration, naming, etc. etc.the code is much easier. It seems to me that the super goals that are necessary before me, and which I personally did not achieve, are to learn to write so that no one, and this is an important point, in general, no one in your team wants to throw it out. So that the code you write and commit always, I emphasize always, is such that it is easier to work with him than to say “what kind of ghoul did you write it? Throw it to hell and rewrite the whole ". And this was naturally justified, because well, it really is faster to rewrite it.
The second super goal at the moment when you learned to write like that, do it not on holidays, on the feast day of November 7th, but always, even when you write, as you think, a draft copy. We all know that a draft is usually 20 years in the repository and settles.
To do this, bad news, a special architect who is hired at the level above or a special consultant who is hired at the side, in principle, is not able to come and do well, and leave, and then come back a year later. Unfortunately, in order for the code to come up to certain standards, such personal or non-personal qualities, to an ideal, and so on, hard work every minute. A - to be able, in principle, to write more or less suitable, B - to constantly apply. Every minute hard work. Any external cowboy code may reveal obvious giant obvious problems, but it will not help you with complex logical bugs on the one hand, nor with a muddy shaft of shit, because it is impossible to rewrite twenty million lines in one helmet.
The obvious point. At best, if everything is bad at a low level, and divine architecture is at the top, then I had a mental image in preparation that I was absolutely unable to get rid of.
At the bottom level, everything is bad and the implementation is bad. On the foundation of shit, we build a house of shit, but from a distance and in poor light this house ideally repeats the divine achievement of architecture to the Sagrada family name in Barcelona, ​​and it’s already completed, but not yet in Barcelona. At worst, even this will not happen; at worst, we will build a last name for the Sagrada, but we’ll get some kind of puddle of which we’ll come up with a standard architecture review, it’s not at all clear what they did here.
Every minute simple practice is unfortunately more important, and they most likely will not save you, or rather, they are not obliged to save you.
I am already at minus five minutes, there is already no time for specific projects, in which I had five minutes of logmentation planned for the fact that there is a project on him a lot of cool kids from interesting companies are working, everything is there, everything is done, written clearly, code, style, design, comments such that God forbid everyone. I'd rather hang myself than go to work there. Any editing just make some kind of hell. Precisely because at the lower level it is formally not bad, but at the architecture level it is quite large, spreading and complex, and high-level documentation about the architecture, how exactly an incredible number of classes work with each other, what particular piece does what it does, it does not exist at all.
This moment, at least for new fighters, would be saved either by a separate document, which is bad, or a large sheet with comments, with short comments at the beginning of the file, that they say it’s arranged like this “this class is responsible for this, and the other for this such changes are made there, and some are made there. ”
“Have you tried it yourself?” An important question should arise, although there is no time to tell, but yes, I tried. I can say something like the following: I feel like writing here, absolutely imbued with Pyaterochka with a plus, let's call it, it doesn’t take much more time. Maybe 10%, maybe 20% more than usual, there are about three artifacts from there in time.
The first artifact - you naturally like it yourself.
Second artifact- Some teammates through force admit that it turned out cool. Not all, it is inevitable.
The third artifact - there are just fewer defects, a certain number of bugs you get caught at the stage of neat writing, neat commenting first. Well, I literally wrote a certain subsystem, some code for a couple of thousand lines and sat down to write a comment on it, how it all works. I sat down to write a comment - I went into development for another four days, because during the writing of the commentary, as arranged, I came up with five test cases and they all worked. The quality of the output increases.
This is a little unnatural habits, you have to make some efforts on yourself, try, perhaps, to break the style of writing, to force the design to introduce, not to cut the corners in any way, to force the commenting to introduce.
Moreover, it is physically painful to say this, but I do not specifically cite specific rules, I specifically refrain from this, because they must always be sharpened for a specific team, under certain rules for formatting, commenting, and so on. I would personally like to strangle the rest of the code for some Kalk, but basically if it works for your team, if you have 20 people in the Kalk residue, then 20 people will strangle me.
One megametrica that can contribute, idealized and not true, but nevertheless at least as much attached to reality, for the sake of which all exercises on oneself are about code on the one hand and about making a better architecture, on the other hand, it’s worth doing, because it’s lightness changes. A code that does not change all the time is dead. The code you are working with is constantly changing, and in this, in fact, the work of the programmer and the programmers department is. Everything is done for the sake of ease of change. Perhaps there is a PM in the hall.
Slide for PM'ov. Is this all about programming? No PMs are also needed, because, in spite of the fascinating motivational reports, programmers rarely organize themselves and implement such things themselves. It is much more effective to impose fire, sword, in the sense of depremiration and dismissal. All the same is nothing interesting, we introduce code-style, we introduce compulsory review, knowledge transfer processes, to whom details are interesting, let's discuss it on the sidelines again.
What to do with architecture?
It is even more difficult to give unified advice simply because all the projects are different and somewhere quite simple, somewhere it is not enough at all.
So what to do ?
If you see this in the code:
Or this:
This is just brilliant, I cried out loud, I was jealous, this is genius.
Why did someone invent this? Why not me? I will never write like that, it is brilliant.
You see this in the code, or this (I wrote this):
Take it down immediately, now, do not delay. Do better, the rule is simple, do it now. After that, it will be easier for you to live straight tomorrow.
The report was called "Take it down immediately." My name is Andrey. I'm being kicked out now.