In one case, an old programmer in his late 30s said. "When developing, copy and paste first" "If you move for the time being, it's OK" "I don't know what happened after I was gone."
I can't help it after I'm 30 years old, but I'm still in my 20s! I've summarized as much as possible what I want you to be aware of at least. If you are a new programmer, please read it. It's Java-based, but it's the same for other languages.
If you are a young programmer, please click here. Five things young programmers should be aware of
If you are a new leader, please click here. Five things new leaders should be aware of
Emphasis is placed on "readability" rather than "ease of writing". It should be easy to understand even if you review it a few months later.
Be sure to understand the code you wrote, even if you refer to the code of others. If you say, "I'm not sure because I copied the process," I'm beaten.
No need for a null check just in case. Check if necessary, do not check if not needed. In addition, there is no need for processing that never passes.
Similar processing is made into a common method. If the processing is similar but the target class is different, use the interface or generics.
It can get complicated. In such a case, write a comment that can be easily understood even after a few months.
For example, follow the rules below ・ Use verbs for method names and nouns for variables so that they are easy to understand.
-Make the scope of methods, constants, and variables as small as possible (Be aware of public protected private, be aware of the location of constant and variable declarations)
・ Set limits for coding and protect (Specific values vary from site to site, so reference values are listed below)
・ Up to 3 nesting layers ・ Up to 50 lines per method ・ One class has 10 methods and up to 500 lines ・ Up to 20 classes in one package
[Readable Code](https://www.amazon.co.jp/%E3%83%AA%E3%83%BC%E3%83%80%E3%83%96%E3%83%AB%E3% 82% B3% E3% 83% BC% E3% 83% 89-% E2% 80% 95% E3% 82% 88% E3% 82% 8A% E8% 89% AF% E3% 81% 84% E3% 82 % B3% E3% 83% BC% E3% 83% 89% E3% 82% 92% E6% 9B% B8% E3% 81% 8F% E3% 81% 9F% E3% 82% 81% E3% 81% AE % E3% 82% B7% E3% 83% B3% E3% 83% 97% E3% 83% AB% E3% 81% A7% E5% AE% 9F% E8% B7% B5% E7% 9A% 84% E3 % 81% AA% E3% 83% 86% E3% 82% AF% E3% 83% 8B% E3% 83% 83% E3% 82% AF-Theory-practice-Boswell / dp / 4873115655)
Recently, there was a suggestion to use the old man again. It's scary.
Recommended Posts