CodeIgniter Forums
Software layers, explained, with examples - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Software layers, explained, with examples (/showthread.php?tid=59043)



Software layers, explained, with examples - El Forum - 08-17-2013

[eluser]sceleski[/eluser]
How do you separate Model to Business Logic Layer and Data Access Layer?

I read many theories but can't find actual examples (files and code) for better understanding. I'm familiar with principles of BLL and DAL but I'm not sure how to implement it properly.


Software layers, explained, with examples - El Forum - 08-19-2013

[eluser]morgs[/eluser]
"How do you separate Model to Business Logic Layer and Data Access Layer?"

This is only the structure of your system. CodeIgniter already has this structure in place for you!

In my application:

Business Logic Layer => In My Controllers (/application/controllers)
- You can also make use of Custom Helpers (/application/helpers). Also see what these helpers offer you: (/system/helpers)

Data Access Layer => My Custom Libraries (Libraries: /application/libraries)
- You can also use models to populate your views

Regards,
Morgs


Software layers, explained, with examples - El Forum - 08-19-2013

[eluser]sceleski[/eluser]
Thanks for sharing that with me morgs.

So, your approach is to store all logic inside the Controller? That sound like "fat controller skinny model" method, except it seems that you rather store DAL in Library instead Model?

My belief is that Model should be responsible for communicating with storage (db) and Libraries should behave as a Service Layer between Controller and Model. Do you also separate that?