Question

At my work, I recently had to rewrite the implementation of a class to adapt it so that it worked with our newer system. Yet, I need to keep the old implementation, since it is still used in other places using the old system.

The class is called SecurityManager. Now, I am making a new class SecurityManager, and it will perform the same operations, but based on newer tables. My problem, is, I'm not sure what to call this new one.

Do I call it:

  • NewSecurityManager
  • SecurityManager2
  • SecurityManager360
  • SecurityManager2000
  • SecurityManager23_09_2013

Is there any naming convention that have tackled this problem before and came up with some naming schemes?

Was it helpful?

Solution

Best is not to change the class name, but add new interface in the old class. This makes incremental work easier (you can gradually make old methods call the new ones, and eventually disappear). However, this is not always possible.

Another possibility is to spend some time to change the old class to OldSecurityManager (or move it to OldSomething namespace). This way the new class can be "installed" in a stable way, without worrying about an ugly name that will stay with you forever (or till SecurityManager3 comes).

Combined solution is to provide a proxy with old interface in front of new one - this also makes incremental work possible, and is more safe (especially with TDD).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top