January 26, 2019
“There are only two hard things in Computer Science: cache invalidation, naming things, and off-by-one errors.”
Much of the difficulty in programming isn’t getting the computer to do what you want, it’s in telling other humans what you wanted it to do (this is typically called intent). In that regard, naming things well is very important.
Though it’s not obvious on the surface, taking your time naming things right is one of the best things you can do with your time. Making a list of possible names, taking a short break from the code, or asking a peer are all great strategies for coming up with the best name for the job.
A few other points about naming:
getMessage
as opposed to getMsg
. The former is searchable, the latter is not.PDP
is a great acronym for e-commerce websites).Manager
, Controller
, and so on. These names likely mean that your code is doing too much in one place.