hello php people 🙂
I was wondering how people organized their tiers on big projects. Right now I have 4 layers i guess you call them.
Data Layer: the classes that simplify database transaction and abstracts from any specific database. Makes it easy to switch amoung databases with a change in what my dbconnection extends from.
Data Access Layer: A have a class file for every meaningful piece of data in the application that provides a higher level access to interact with the database. All other layers will interact will data access layer objects if they need to use the database. Some common methods are create, edit, remove, removeAll, findByPrimaryKey, findByName, findByWhateverElse and the business methods that apply to that model of data only.
Process Layer: Anything that has to model a workflow or process for the website. presentation tier interactions with the class and all the process is kept from page to page without the client user knowing the details. Search engines are also in this category as well as any site structuring objects. Not applicable for everything on the site.
Presentation Layer: View objects for everything on the site. These interact mostly with the Data access objects. For instance to view an article on the system, it knows how to format it but does not know how the data is retrieved, etc. This also includes the forms, menu bars.. basically templates for all the include files and sub-included files for page presentation. Like a search form, a menu bar, artcile listing, etc. would be all seperated into different files and would be included in the main site template. All other html, css, etc. files are here.
i have the directories structured this way
/sitename
/sitename/lib/data
/sitename/lib/dao
/sitename/lib/process
/sitename/lib/presentation
/sitename/css
/sitename/graphics
/sitename/js
/sitename/sectionname (for all subsections on the site)
basically ../lib/presentation contains the view objects but all the other presentation is in the normal places.
Is this an effective approach? What are all other developers doing? I would like multiple suggestions and view points to help structure my sites better.
Thank you so much!