My thoughts as an enterprise Java developer.

Friday, January 22, 2021

Naming variables

It isn’t very useful to name variables based on information that can be easily determined on the declaration line. It is useful to name variables based on the purpose of the variable. Otherwise the purpose may be spread out across the usage of the variable.

In code it is often easy to answer “what” but hard to answer “why” so the code should be written to answer “why”.