Clean Code: choosing good name

Bramanta Nararya
Kami PeoPLe
Published in
1 min readFeb 25, 2020

“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

In“I never seen code as messy as this one”

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

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. 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.

  1. Choose descriptive and unambiguous names.
  2. Make meaningful distinction.
  3. Use pronounceable names.
  4. Use searchable names.
  5. Replace magic numbers with named constants.
  6. Avoid encodings. Don’t append prefixes or type information.

It’s a bad article, made in a hurry, thank you

--

--