📜 ⬆️ ⬇️

7 golden rules of one programmer

This article is about seven simple rules that I have formulated for myself over the years as a programmer. Seven rules that raised my effectiveness. Made me better. These are my rules and they work for me . I'm not trying to impose them on you, I want to share with you, and, perhaps, to learn about what rules and principles you adhere to.

The computer is always right


The most annoying programming situation is when the code is correct, but it doesn't work. “ Yes, there are three lines, damn it, there is simply nowhere to be wrong! Probably a bug! I will spend three days studying the compiler / interpreter / framework bug reports ... ”. There is a feeling that the computer is mocking you!

The main thing to remember here is that there is an error in these three lines. If the code does not work correctly, then the code is written incorrectly . Point. Only you are to blame. Universal advice - go to sleep! Or at least get distracted by a cup of tea. When, after a while, you return to the code, it will probably become clear that there is an extra negation operator, or two variables are confused with similar names, or some other trifle, in which we never admit to anyone.

Calm down and succeed


Emotions are our worst enemy. Personally, I, as you have already guessed by the number of exclamation marks, an emotional person. And sometimes I find it difficult to concentrate on the code, especially if I did not write this code, and the code is not of the best quality. The brain somehow switches on itself to the development of highly sophisticated methods of torture for the author of the code.
You need to force yourself to calm down. You need to take the task not as a mockery of your brain, but as a challenge. Yes, bad code, yes, there is no documentation, yes it is difficult, but I am a programmer, this is part of my work and I can do it .
')

The most difficult thing is to start


Sometimes you look at a task, and you do not know how to approach it. Which side to start? And in general, something lazy today. “I'll sit for 10 minutes in Vkontaktik, then I'll start. Well, after coffee. Well, the old code needs to be refactored, and then I'll start. And this is something for task with low priority? I will execute it and will definitely begin ... ”
Just start . Start at any end. Break the task into smaller parts and start performing them. Stop procrastinating, discard extraneous thoughts, concentrate on the task, and get started. Then it goes like clockwork.

Read books


Read books. I will write again: Read books!
For some reason, many programmers completely ignore books. “ I am very enlightened at work ”, “ I don’t have time ”, “ I read articles on the Internet ”. This is all great, but personally I think that the best source of knowledge is still books. I consistently buy one or two books a month, plus I reread something old from time to time. I will not lie, I have an impressive stack of what I bought on the shelf, but I haven’t read it yet (as with the incentive games) , but I’ll go, I’ll definitely go.

Know your tools


Do not be lazy to take the time to study in detail the tools and technologies with which you work. It will pay off many times. Thoroughly explore all the features of the language in which you are programming. Just grab and read the official documentation from cover to cover. Do not use IDE only as a code editor, in any modern environment there are a lot of tools for improving the quality of code and your productivity. Do not use the framework only as a skeleton of architecture. Learn it and it will save you a lot of time. Understand the intricacies of the version control system. The better you know your tools, the more work they do for you .

Don't be a perfectionist


Above, I wrote that the most difficult thing is to start. So, it is not always easy to finish. Debug and refactor code can be infinite. “ What is the long method? "" Maybe it's in a separate class? "," It would be more convenient if ... "," And what if it will be needed later ... "," And what if ... ". In programming, you cannot be a perfectionist. The problem is that it is enough to read Robert Martin or the Gang of four, as there is a desire to rewrite all your code. You need to understand that there is no perfect code. I adhere to the rule: " The code should work without bugs, be tested and readable ." Everything. As long as the method code meets this requirement, I don’t touch it. Even if it has two cycles, three conditional operators and four parameters.

Be able to relax


The biggest problem for programmers is that we love our work. My vacation starts breaking, a week without programming - and I have a dream about how I think over the architecture of the new application. Plus, the programmer is not difficult to find orders on the side, which can be dealt with at night. Plus your projects. And how many times you could not fall asleep, because the brain refused to switch from the task you were doing all day?
All this leads to fatigue, and, as a rule, to a decrease in productivity. Rested programmer is an effective programmer . Get enough sleep. Find yourself a hobby that is not related to brain activity and devote him a couple of hours a day. This will divert the brain from work, restart it. The most interesting ideas and the most correct decisions recently come to my head in the gym.

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


All Articles