An anonymous developer wrote an article for Netology about who programmers are, how they become, and why all programmers go to their own Thailand. Provided that they write readable code, of course.

If you think that being a programmer is simple, then you are mistaken. If you think that it is difficult, you are also mistaken. So who is such a programmer how to write cool code and what distinguishes good tone from bad in Thailand or without him we deal with the anonymus.
Programmers are born
No matter what anyone says, you can determine a potentially good programmer before a person starts learning any programming languages. As it seems to me, a programmer is, first of all, a person with a non-standard and flexible thinking, and learning some programming language is a new thing.
')
Gathering a team in a company, I often relied precisely on how a person thinks, rather than on what set of knowledge this person carries with him. It was assumed that part of the knowledge will be transferred within the team, based on the needs, technology stack, features of the software product. How to try to determine the way of thinking? I will give an example of several tasks that once asked me during interviews, and after that I have already asked.
If you want to test yourself or expand the palette of questions asked at the interview, I think they will be useful to you. After all, each of these tasks is a way to determine certain important criteria when selecting a specialist, such as “decomposition”, “search for algorithmic errors and loops”, “ability to operate with simple elements”, “abstract thinking”, etc.
1. You have 2 variables A and B. Imagine that A = 7 and B = 8. Change the values ​​of these variables in places using only classical mathematics. You cannot use the 3rd variable, and you cannot use functions from programming languages ​​that you know. Try to apply only classical mathematics. And yes, the solution should not be private and should work with any numbers.
2. Imagine that you are standing on some point of the globe. You have a compass in your hands. I tell you: "Go to the Northeast." What is the end point of your journey, which in fact can last indefinitely, but still end at a specific point.
3. Two chimney sweeps come out of the pipe. No matter how paradoxical it may sound, one has a clean face, and the other has a dirty face. Which of them will wash? It is important to know here that there is no one solution for this task - there are several solutions. And each of them can and must be justified.
4. The classic problem "Wolf, goat, cabbage." Extremely simple task, but I love her very much. It sounds like this. You are a boatman, you need to transport the above objects to the other side. But there are some conditions. You cannot take more than one object into the boat, and you should not leave a wolf and a goat together, as he will eat it, and a goat with cabbage for the same reason. Forward!
5. You are a scientist. Before you is a Petri dish containing a very dangerous type of bacteria. You know that the number of bacteria is increasing every minute by 2 times. We know for sure that at 12:00 the cup will be completely filled with this extremely active type of bacteria, and we need to hurry. Answer the question: at what time will the cup be half full (or half empty, as you like)?
6. Problem to round. Suppose you are developing a system for a company that works with retail. Their motto: "no cents." But our task is to round off not just to kopecks or to tens of rubles, but to round up to 50 rubles. That is, 130 rubles are rounded off at 150 rubles, and 115 rubles - at 100 rubles. How to make rounding on this principle?
* I will write the answers at the very end of the article. And while you think about it.
Where to go, where to go
The choice of programming language is completely yours. But since we are talking about web development, we will consider the choice between the
front end and the
backend .
If you still do not know what it is, then in simple terms the front end is what you see on the web resource, the user interface and the levers of interaction with the technical part of the resource. A backend is something that you, as a user, will never see.
The frontend hides the full power of the logic of any web resource on which you are located. If you draw an analogy with a car, then the frontend is the interior of the car, and the backend is what is inside, under the hood and upholstery. There are certainly resources where most of the logic lies just on the shoulders of the front-end developer. However, in the overwhelming majority of web resources, the backend is responsible for the logic.
If you are faced with a choice of which side of the force to take, then I would recommend that you try yourself on both development fronts.
"Touch" and already decide what is closer to your heart, perhaps, you will generally become a generalist who can write quality code on both sides. By the way, I will share with you my observation. Often, those who write the backend part can also write frontend. But this rule rarely works in the opposite direction.
I do not want to offend a large army of front-end developers - this is just a personal observation. And it is important to understand that backend development is far from always related to web resources, very often we hide under the hood of mobile applications and various highly specialized services.
Practice Tips
If you still decide to become a developer, I would like to share with you some observations, mistakes and a couple of stories from my own experience.
Natasha Rostova syndromeThe following definition appeared in my circle when a joke about a programmer’s everyday life appeared on the Internet:
“Imagine that you are a writer and support the project“ War and Peace ”. You have TK - to write the chapter, as Natasha Rostova walked in the rain in the park. You write "it was raining," you save, and the error message flies: "Natasha Rostova died, the continuation is impossible." Why did she die? You start to understand. It turns out that Pierre Bezukhov had slippery shoes, he fell, his gun hit the ground and shot at the pole, and the bullet from the post ricocheted off Natasha. What to do? To charge the gun with idle? Change shoes? We decided to remove the post. Get the message "Lieutenant Rzhevsky died." It turns out that in the next chapter he leans on a pillar, which is no longer ... "What is the salt of this story, I think you understand. It is important to make the right conclusion when you are designing some new system blocks, or you are correcting the old ones - be more far-sighted and do not be lazy to spend time comprehensively studying the possible consequences that your refinement may lead to. You will say, because for this there are testers, and it is their task to find such failures. Yes, that's right, but there are some nuances.
Imagine that you have made hot changes to a resource through which any financial transactions go, and the tester treated his work the same way you did. The company is a user of the resource, risks getting financial losses, and the reason for these losses is you. On my personal example, there was a case when a developer introduced a discount in an IM (online store), but for one reason known to him, he reversed it, that is, the discount for the product was not 5%, but 95%. Naturally, we very quickly discovered the error and eliminated it, but it could be much worse.
Dangerous worldWhen designing your code and / or participating in meetings of the development team of any project, try to think in advance that your project will live in a hostile environment. And among those who will use it, there will be those who will try to either break your project or steal data from it. As in the previous case, I will give a couple of examples from my own practice.
One day, a manager came to our company, who actively tried to impose 1C Bitrix on us (we’ll skip the controversy about why AIDS is in computer equivalent, and it shouldn’t be allowed into your company). This manager gave a big presentation, where we all were given special logins and passwords with which we went to some demoserver.
While the manager was rubbing our guide about what a healthy product this was, I added a new product, in the description of which I included a link to the JS script. And a minute later we were all sitting playing snake on the product catalog page. I didn’t stop at that and quickly made a
JS-script , with the help of which after a couple of minutes I forced him to restart to Beatrix, and received his login and password.
Of course, after that the presentation was completely disrupted, and the manager with a very thoughtful look went away. Naturally, after that, the company's management raised the question that one such script, embedded in the product description, would allow us to drag off user data and could cause tremendous damage to our company.
A similar situation was at the presentation of the product that the contracting company planned to implement in the medical institutions of our region. All one to one, only the presentation was attended by the Minister of Health and the consequences were sad for the contractor: the project had to be redone very long.
So be prepared for the fact that at any moment you may encounter such holes. Will you say https? Secure connections? Believe me, the price of a question of an exploit of this kind is the price of a bribe to the person who can make at least some corrections in the whole system (even the usual editing of the text in the title), and the consequences can be unpredictable.
Do not divide by zero, young padawanOften, programmers ignore the detailed analysis of the error log, which generates the server when the developed system works. Some will say, “Oh well, Notice and Warning will do no harm,” and some of them will be damn wrong. Since each Notice or Warning requires time from the interpreter for it to write to the error log. Thus, if you have a cycle that generates only one error, and in this cycle there are 400 iterations - one “turn” of such a cycle will give you 50 kilobytes of garbage in the logs, and, besides that, it will take about a third of the script time.
An example from experience: one information system contained many analytical reports; in one of them there was an operation that could sometimes divide by zero, eliminating this error, I received acceleration in generating a report several times faster. Imagine if you have a multiplayer system? In this case, the appearance of the error log file will be a sentence for you - be afraid of it, and always correct all errors that occur.
Love git like your brotherFrom the first days use the version control system. This is an important skill, which is now used, if not all, then 99% of adequate and correct programmers. A large number of control systems - the choice is yours. The main thing you understand is a damn good habit. No wonder there is a picture explaining the importance of the ability to use version control systems.

"In case of fire: commit and run."
In my experience, I focused on the two systems GitHub and Heroku. If the first is extremely famous, then the second is known to very few. The main advantages are: free project privacy and a unique https-link to your project. By the way, a very cool solution when developing Webhook for Telegram bot.
Make friends with JSONNo matter which side of development you took, try to use JSON when transferring data. An extremely convenient and useful thing, from working with which you will not get anything but positive emotions.
If you are a backend developer in a large web project, you need to think about your smaller brothers — frontend developers — give them data in JSON format.
And if the front-end developer gives you data like anything, teach him to use this format. Believe my experience, it will save you from many problems and make the transfer of data between the front and the engine more flexible.
Ode to jQueryProbably jQuery is the most famous and popular library for front-end developers. If many libraries can be neglected and live without them, then jQuery is your right tool. Someone may disagree with me, saying that everything that is written on jQuery, you can write in pure JS, to which I will answer: "Yes you can, write." This thing really save you from headaches and solve many of your problems. I would say that this is the “Swiss knife” in the world of JS libraries - and many will agree with that.
A word about frameworks and OOPOOP is object-oriented programming. Very correct and necessary component of the evolution of any developer. And be prepared that evolution will lead you through the whole chain: pure procedural style → functional style → object style, if you stop at the beginning or in the middle of this chain, the industry will destroy you as a non-viable creature. But there is one thing that both beginners and experienced developers should consider: OOP is appropriate where it is needed.
In my practice, I have often met colleagues who, in any situation, tried to apply their knowledge in this field. Here is a simple example. In one of the supported information systems, there was a module responsible for sending PUSH notifications to users of the company’s application. So, for 7,000 users, the procedural code did a mailing somewhere in 5-6 minutes, when the code was copied to the PLO for ideological reasons, the mailing began to take 10-15 minutes.
Many of us know foreign languages, but we do not speak them in any situation. We speak them only when we need it. This rule works both for OOP and for choosing a framework for your project. These things cannot be neglected: both are designed to solve certain tasks in certain situations, and there is no need to apply them unnecessarily.
I already feel how a huge army of framework lovers is burning with the desire to arrange a holivar. Calm down, guys, because I did not say that this is bad and not necessary, I just said that everything has its place. And the experience of high-quality template programming without the use of frameworks is very expensive, and weighs exactly the same as the knowledge of their modern lines. And in my experience, I have repeatedly met projects that, with minor modifications, could become another framework, of which there are so many in our world.
So let's summarize this important moment of the developer’s evolutionary development:
Learn how to use OOP and frameworks for quality - this is important, but remember that you don’t need to apply them everywhere, especially where they don’t need them.
Have a good toolkitA programmer, like any technical specialist, must have a set of good tools that help him solve certain problems. This applies to both the IDE in which you write the code, and the DBManager in which you manage the database. You can endlessly talk about the pros and cons of various development tools, therefore, in this case, I will rely on my experience.
The finest IDE for
PHP development is PhpStorm, most of them are probably familiar with it, and so far I haven’t been holding anything better. And the best I've seen for working with SQL databases is HeidiSQL. Here I am ready to argue until the wheeze. If you have the ability to remotely connect to the database - forget about phpMyAdmin forever, everything that you do there, spending 5 minutes, I can do through HeidiSQL in 1 minute.
As for all sorts of ancillary tools - here each specialist will eventually pick up his or her palette. Above, I only recommended the basic set, which should be in service with most specialists. I see again how you have a desire to argue with me. I answer.
It is important to understand that a specialist should use not only what he is used to, but also what saves his time, nerves and strength.
Comment on everythingGet used to commenting on almost every part of the code, because it will greatly simplify the analysis of the code by your colleagues, or it will speed up the memory when, after a while, you will look into this code. This is a very good habit, and it needs to be developed from day one. There is a wonderful picture that says everything for me.
Of course, it should be borne in mind that you will not always work on the project, so the readable code is good, but you should not forget about the good tone for your followers in the form of commenting.

Why # TAI?
Briefly and clearly. And evil. This is what I say to myself. Or just about myself. A programmer is an “animal” who needs terrarium conditions. There are many ways to create them artificially. Starting from "Ballmer Peak", google, and yes, yes, I think this is a doping stimulating factor, and ending with ideological incubators like Google. In them, the developers live in the company and, thus, regularly fall into the "coding attacks", finding themselves in the right place at the right time. And it gives a very high efficiency of the company.
But, as in any animal husbandry, more benefit can be obtained from an animal that is on free grazing, and, as for me, Thailand is a very suitable place for this. I know many colleagues who have gone there and are now working in this hot country. And among them, and I, too.
If someone from HR managers or company executives is reading this article, you should know that a programmer sitting in an office from 10 to 18 is a programmer with an artificially low efficiency.
In my practice, one company owner understood this, and the programmers worked from 10 to 14. They received the same salary level, because the boss knew that in 90% of cases the programmer continued to work at home when he felt strong, not when it takes time to be in the office. But this is my opinion and experience from my practice. Maybe in your case you like an office in stuffy Moscow from 10 to 19. This is your choice.
Love programmers, take care of them, and your company will get better products, and there will be no more practice like: “Huyak-huyak and in production”.
Answers to questions at the beginning of the article
1. Many people remember this problem from the mathematics course of a school or university. There are two solutions, and they are quite simple. A = 7, B = 8. In order to swap values ​​without a third variable, we need to somehow save the “memory” of the current values, and this will allow us to do either addition or subtraction.
The first iteration: A = A + B (7 + 8 = 15), now you have A = 15, B = 8. The second iteration: B = A - B (15 - 8 = 7), now we have B = 7, A = 15. The third iteration: A = A - B (15 - 7 = 8), now we have A = 8, B = 7. Done! The same can be done using multiplication and division.
2. In this task, it is important to understand that our earth is not a flat map on your table, but a spherical geometric figure. Now, figuratively mark on this sphere the sides of the world. Take the compass and go. If we follow the compass only to the northeast, then we, sooner or later, will come to the north pole - this will be the end point of the journey specified in the problem statement.
3. I will not describe all the solutions here, since it will take a lot of time. I will suggest you read the parable of the chimney sweepers. There are a lot of names, write in Google “rabbi and chimney sweeps” or “Socrates and two in a chimney”. In general, I highly recommend reading.
4. In this task, it is worth remembering that the condition does not limit you in that you cannot transport objects in both directions, that is, take it back. Thus, we first take a goat and transport it to the other side. We return and pick up, for example, a wolf and transport it, plant it and pick up a goat. Returning with a goat, pick up cabbage and plant a goat. We transport cabbage and return for the goat. It's simple.
5. It's easy here too. In the condition of the problem it is written that the population of the bacterium doubles every minute, and at 12:00 we will have a full Petri dish. Therefore, it can easily be said that the cup will be half full at 11:59.
6. Since we have a minimum bill of the problem - it is 50 rubles, we will rely on this number. To round up 130 rubles to the next 50, do the following:
We divide 130 by 50 and round up to an integer value (130/50 = 2.6 = 3), and multiply the result by 50 (50 * 3 = 150). Is done.
We perform a similar operation with 115 rubles (115/50 = 2.3 = 2) (2 * 50 = 100). Is done. You can check with other numbers.
Good luck.