Pergunta

I'm working on a project with a MVP architecture.
My program revolve around forms that give rights to people.
There are X differents forms depending on profiles ( so there are X differents profiles)
I have an abstract class which we will call BasicFormClass.
Each forms has a presentation that inherits from BasicFormClass
The more I work on this project, the more I observe my presentations becoming "fat", especially BasicFormClass : a lot of functionnality are called and execute by it.

So my question is : Is a presentation potentially a god object?

Foi útil?

Solução

Is it getting fat from low-level statements or because the complexity is increasing? If it is the latter, use a helper class to reduce the bulk. If it is the former, consider refactoring common tasks and handlers to allow handler classes to deal with such things (bonus points if derived classes can make use of them as well).

Your BaseFormClass is only a god class if it contains all the logic. There is nothing wrong with BaseFormClass delegating tasks to other classes, thereby freeing up BaseFormClass to the very basic decisions necessary for your class to work.

Consider creating an event handler or user controls to help separate smaller responsibilities handled in BaseFormClass into their own classes. Good luck!

Licenciado em: CC-BY-SA com atribuição
scroll top