Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
OOP begginer organising project
Ok, I started a few days ago to learn OOP. Basic concepts I understand but now I want to create a project and use Design Patterns in it, so the first idea was with singleton patterns.
I have 3 tiers GUI-BL-DAL on GUI I have MVC but that is not important now. I want to find the best way to communicate between this tiers so the first idea was:
BL classes: Manager, BookManager, MemberManager, EmployeeManager;
DAL classes: Storage, BookDAL, MemberDAL, EmployeeDAL;
BookManager, MemberManager, EmployeeManager, BookDAL, MemberDAL, EmployeeDAL implement their interfaces IBookManager ... They hold my application functionalities.
Manager and Storage are Singletons which instatiates other classes from their layer so if I want to invoke some DAL method from BL i say:
BookDAL is property that return IBookDAL.
But I heard that singletons are bad. So I want to try to change this somehow now I'am trying to do layer communication with Factory pattern but I dont know if this is good.
Can somebody direct me what is the best practices for communication between layers in application? Is my approach good or bad.
One more question where is the best place to keep cached data (from database for example, list of members in a grid ...) is it in BL layer or GUI/Proxy layer?
0 · ·