10868 shaares
395 private links
395 private links
So there is four stages of quality for each name :
- Nonsense : For example, we might extract a method from a larger one and quickly rename it
somethingWhatever()to get the refactor done and the tests passing. - Accurate : We rename the nonsense method to what it actually does, such as
processPayroll() - Precise : Once we realise what the method really does, we might refine the accurate name and give it more precision, such as
loopThroughEmployeesAndPayThem(). - Meaningful : At this point, we’ve revealed the complexity of the method, and can look to split it up into two methods:
forEachEmployee()and perhaps apayWages()method on a separate interface.
I always use at least accurate names, because it helps me even during the development process. Something I tend to is to use meaningful names and thus creating a lot of functions 😅
I dislike the precise one as it looks as a function that need to be changed, because of doing to much things. At least, this reveals the complexity behind the name.