Overview
Human brains work in a pattern-like fashion. Starting from the first class, the concept of operation and use of each subsequent class should be generalized throughout the project, facilitating and iteratively accelerating the speed of understanding how the code works.
For this reason, once we know that one class uses the method, store(), we should expect that another class for the very same mechanic also uses the store() name for that, instead of add(), put() or place().
Causation
In a team project, members could have omitted checking the existing naming in other classes [1]. They could also intentionally choose different naming methods to distinguish classes according to the naming convention of functions.
Problems
Standardized communication through names is vital for mental shortcuts.
The developer expects a method inside a sibling class but can't find it and has to look up synonymous variations of the method he wants.
Example
1class Human:
2 def talk():
3 ...
4
5class Elf:
6 def chat():
7 ...Refactoring
- Rename Method
Sources
- ORIGIN2004 · ISBN 978-0321109293