Graduate Program KB

Chapter 2 - Meaningful Names

  • Names are important for clean codeb cause they help developers understand the purpose of the variable and function.
  • The variables should be named their intention:
    • Choose a name that specifies what is measured and the unit
    • lengthInCM, dayOfWeek.
    • No ambiguous names such as, e.g) const Day; could mean dayofmonth, dayofweek, etc.
  • Names should be consistent and follow naming conventions established by the team.
  • Use pronouncable names.
  • Searchable names.
  • No slang in names.
  • No abbreviation in names.
  • Use domain specific names.