I have a large "Manager" class, which I think is too much, but I'm not sure how to divide it into more logical units.
In general, a class consists mainly of the following methods:
class FooBarManager
{
GetFooEntities ();
AddFooEntity (..);
UpdateFooEntity (..);
SubmitFooEntity (..);
GetFooTypes ();
GetBarEntities ();
}
The Manager class is part of my business logic and is an instance of another Manager class at the data access level that contains all CRUD operations for all objects.
I have different objects coming from the data access level and, therefore, I have a converter outside the Manager class to convert data objects to business objects.
The reason for the manager classes was because I wanted to be able to mock each of the "Manager" classes when I did unittesting. Each of the manager classes now exceeds 1000 loc and contains 40-50 methods. I believe that they are quite bloated and find it inconvenient to put all the data access logic in one class. What should I do differently?
How can I separate them and is there any specific design pattern I should use?
Xerx source share