views:

85

answers:

2

Hi Folks, I want to get your opinion on this.

I have a class which is derived from a base class. I don't have control over the code in the base class and it is critical to the system that I derive from it.

In my class I inherite two methods that are critical to the system and are used in pretty much every function, many times.

I intend to refactor this derived class and extract some classes from it - this won't be a problem. What I'm not sure about is, is it worth extracting class if I have to constantly make call backs to my main class to access the two methods (or public wrappers to the methods)???

Thanks

+2  A: 

Not sure in your case but refactoring is for your benefit and others. You have to weigh the cost of refactoring with benefit of code up-keep. The point of method extraction (and not copy-and-place) is that it centralizes it and makes it easier to deploy changes. So it is probably worth it if you have the code everywhere.

Curtis White
+1  A: 

Based on your concern about dependencies, it sounds like you'll probably have to let the "main class" continue to be the "front door" for now--i.e., the class that everyone calls. Let the main class delegate to the extracted classes, not the other way around. Without more details, that's all I can think of to say.

apollodude217