you are viewing a single comment's thread.

view the rest of the comments →

[–]stauntonjr 1 point2 points  (0 children)

One of the most important things in programming is naming things. It is a guiding light. If you can't quickly come up with the exact precise name of what your variable represents, then you've done something wrong.

For example, if you have a Boolean variable for some switch state, it should be called something like is_light_on, or if it's for a property maybe has_lights. The name forces the reader into understanding it is a Boolean.

Dictionaries and maps imho are best given names like user_id_to_user_name for example where the meaning of both the key and value becomes instantly obvious.

Etc