Naming
Use names that show what your code does.
int dcould beint dayAvoid misinformation. if
accountsList.is not a list, it should have a better name.Make a good distinction of your variables.
CustomerData,CostumerandCostumerInfo. What's the difference between then?Use names that you can pronounce. If you pair, you don't need to refer to a variable as
wpdw. AworkDaysPerWeeksounds better.Use searchable names. Have you tried to search for a variable called
f?Avoid prefixes. If the variables start with
icsd, likeicsd_nameoricsd_datewe'll have a hard time to find what we are looking for.Avoid mind mapping. When we use a huge quantity of variables that don't make much sense, we need to memorize what they are meanwhile we are trying to figure out what the code does.
Class names. Should be nouns, and not verbs, because classes represent concrete objects. They are the representation of things.
Methods names. Should be verbs, and not nouns, because methods represent actions that objects must do.
Add context. If you bump on a variable
statealone, probably will have a hard time to figure out what it means.streetandnumberit's easier to understand what it does.Add context, but not for free. We are working on a project called
chocolate ice cream. We don't need to addCICin front of all variables.Userclass, we don't need to call all the variablesuserAdress,userAgeoruserFavoriteColor.
Last updated