Consider you have the following code:
class UserContainer
{
List<User> user;
//some methods to get specific users, for example users, which are higher than 1,70meters
}
The User have a lot of different responsibility and features, so in the example the user is our god-class. There a lot of methods which are used from outside, from clients
So now let us refactor the God-Class into smaller units.
like it is described here: http://scg.unibe.ch/download/oorp/OORP.pdf (PDF-Page 281, chapter 9.3 Split Up God Class).
So there we should refactor the godclass into classes which bundles high-cohesive features/fields. The old User class is near the end a facade-class with more than 100 methods.
In the final step you should remove the facade/old-god-class itself.
Ok, how should that work?^^ There is no answer in that paper how to do so, if you have something like i have in the example.
So maybe i want to get from the UserContainer all users which are 1,70meters high and then i want to do some special behaviour with that user, some behaviour which was before my refactoring in these 100 and more methods. But if had it refactored now, and deleted the god-facade class in the last step -> so there is no user anymore........ äh how?!^^
So the question is easy: How should i remove/refactor a good-class with its 100 and more methods (+ removing in the last step a possible facade)?
One more point, which is not adressed in the paper, how you would instantiate the new classes and wire them up?
Edit:
I want to add some additional notes to make things clearer:
The UserContainer is not the god-class, it's only a class with one Responsibility, so maybe i should rename it to UserHeightFilterContainer
like Flatter used in his answer.
The problem then is not how to sprout and split the class User
like Kain0_0 described in his answer, if we still have the facade UserFacade at the end, because then i could still have
List<UserFacade> user
in my UserContainer
or UserHeightFilterContainer
but if i now want to destroy the facade UserFacade then i dont have something left which i could use in the List or rather UserHeightFilterContainer
. And i want to know how to destroy that facade with the constraint to continue using the UserHeightFilterContainer
Let' say i want to get all Users which are 1,7meters high from that container and then i want to call some User-behaviour which is then not anymore in the user because i sprout and splitted it^^