I have a data layer that strictly interacts with the database and returns the result into a model. I have an asynchronous connection with the DB so sometimes I have to chain results where I have to do many queries.
I have about 1000 lines of code in a single class and It's getting hard to manage.
My question is, how do you re-factor/organize something like this? Do you break it up into multiple classes, maybe by functional area? Do you have one parent class that calls sub classes with the code in it?
Ie if you have DataAccess.class with everything in it would you break it up like this: DataAccess_FunctionalAreaA_Insert.class DataAccess_FunctionalAreaA_Update.class DataAccess_FunctionalAreaA_Delete.class DataAccess_FunctionalAreaA_Read.class
DataAccess_FunctionalAreaB_Insert.class DataAccess_FunctionalAreaB_Update.class DataAccess_FunctionalAreaB_Delete.class DataAccess_FunctionalAreaB_Read.class
I would probably use namespaces to break up the above, but I wanted to illustrate how one might break it up. What would you do?