Clean Code: choosing good name
“Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer’s intent but rather is full of crisp abstractions and straightforward lines of control.” — Grady Booch
Imagine you are a new developer in a tech company. You come to work at the morning and your tech lead brief you for an undone project. Then you receive it and start working on it. Suddenly you goes
Clean code is important. It’ll make your live easier and other people easier. In general, according to Clean Code by Robert Cecil Martin there are 4 rules to write clean code
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
The most basic thing to improve your code cleanliness is choosing the right name.
- Choose descriptive and unambiguous names.
- Make meaningful distinction.
- Use pronounceable names.
- Use searchable names.
- Replace magic numbers with named constants.
- Avoid encodings. Don’t append prefixes or type information.
It’s a bad article, made in a hurry, thank you