[JAVA] I want you to be aware of what you will develop together from next year. (From "Readable Code")
Famous "Readable Code-Simple and Practical Techniques for Writing Better Code" (http://www.amazon.co.jp/ Readable Code --- Simple and Practical Techniques for Writing Better Code -Theory-practice-Boswell / dp / 4873115655), and summarize what I wanted the juniors who develop with me to know.
(This book uses Python, JS, Java, and C ++ as sample code.)
principle
"The code should be easy to understand"
Cool / short ≠ easy to understand / read
Superficial organization
- Fill the variable name / function name exactly with information
- Divide the variable declaration into meaningful groups and comment on each group
- Do not consciously write comments (trivial content) that should not be written
- Clarify "your thoughts" and "reasons for reaching that conclusion" when writing the code
- The part that has nothing to do with the essence of logic shows it firmly
- Answer questions that you absolutely ask in the comments
- For complex functions, give an image of input / output using an example
- Explain the function (what you are doing), not the programmatic meaning
Logic simplification
- Divide huge things into sizes that are easy to eat (easy to digest when reading)
- Make variables immutable
- Don't put useless variables
- Distinguish and separate essential logic from unrelated sub-processing
- Wrap without compromise on a non-ideal interface
- Export and organize tasks and do not mix multiple processes at the same time
- Keep variable scope small
Description
- Try to explain aloud what you are doing in that part
- Focus on the keywords used in the explanation
- Try to explain and organize the features again
Of course, it's a programming book, but there are some parts (I think) that are quite connected to the tips of the presentation.
In the end, I think it's about thinking about what you can do to shorten the understanding time of the other person.