Assumption #1: Thinking about the right abstraction for a web application, the directory containing the library of classes should be located outside of the directory containing the presentation files. This organization adheres to the DRY ("Don't Repeat Yourself") principal allowing for multiple presentation folders (domain.com, management.domain. Com, api.domain.Com, etc. ) to work with the same objects This is correct in the sense that libraries are not used for presentation (i.e.
Not views). They are modules that will be used across multiple controllers. Usually they should not use persistent data since they are not models but in some cases do (codeigniter sessions for example) Assumption #2: If all your classes are located outside of your presentation folders, then the models in your MVC implementation just use instances of those classes.
If that's true, then the MVC framework is just a presentation class (the controller) that helps to manage the input (GET & POST requests), the response (models or instances) and output (views or templates) This is a little confusing to me. You are correct the the controller is just used for orchestration of GET and POST request but becareful about calling then the "presentation class". The controller is responsible for the orchestration of models (persistent data) and views (presentation of data) Assumption #3: If the MVC framework is just a presentation class, then the database class that the controller instance initializes breaks the abstraction of the controller class.
A model (of the controller instance) shouldn't have a ("has a") database, it should have a thing (user, product) from the library of classes and that thing should have a database This is very confusing and I don't really understand what you're saying here. MVC is a just a "presentation class", a model doesn't have a "database", the framework may hold a connection to a database and models are abstractions of the database (object like user, product) Assumption #4: Furthermore, if the MVC framework is just a presentation class, the database class that the controller instance initializes is too tightly coupled with the controller class. Changing from one method of storage to another requires re-factoring of all the models The controller doesn't initialize the database, the framework usually handles controllers only access the abstraction of the database (models).
If the database system is replaced by anything only the implementation of the models interface is re-factored Assumption #5: With a HMVC framework, the issues with the controller containing the database is worse, because your models are more module (more models, more re-factoring) HMVC doesn't necessarily mean more models. Using HMVC allows for portable modules from a project that can be access across multiple controllers. Often you will see Libraries doing this in non HMVC frameworks ie Library that doesn't some db/templating.
Assumption #1: Thinking about the right abstraction for a web application, the directory containing the library of classes should be located outside of the directory containing the presentation files. This organization adheres to the DRY ("Don't Repeat Yourself") principal allowing for multiple presentation folders (domain.com, management.domain. Com, api.domain.Com, etc. ) to work with the same objects.
This is correct in the sense that libraries are not used for presentation (i.e. Not views). They are modules that will be used across multiple controllers.
Usually they should not use persistent data since they are not models but in some cases do (codeigniter sessions for example). Assumption #2: If all your classes are located outside of your presentation folders, then the models in your MVC implementation just use instances of those classes. If that's true, then the MVC framework is just a presentation class (the controller) that helps to manage the input (GET & POST requests), the response (models or instances) and output (views or templates).
This is a little confusing to me. You are correct the the controller is just used for orchestration of GET and POST request but becareful about calling then the "presentation class". The controller is responsible for the orchestration of models (persistent data) and views (presentation of data).
Assumption #3: If the MVC framework is just a presentation class, then the database class that the controller instance initializes breaks the abstraction of the controller class. A model (of the controller instance) shouldn't have a ("has a") database, it should have a thing (user, product) from the library of classes and that thing should have a database. This is very confusing and I don't really understand what you're saying here.
MVC is a just a "presentation class", a model doesn't have a "database", the framework may hold a connection to a database and models are abstractions of the database (object like user, product). Assumption #4: Furthermore, if the MVC framework is just a presentation class, the database class that the controller instance initializes is too tightly coupled with the controller class. Changing from one method of storage to another requires re-factoring of all the models.
The controller doesn't initialize the database, the framework usually handles controllers only access the abstraction of the database (models). If the database system is replaced by anything only the implementation of the models interface is re-factored. Assumption #5: With a HMVC framework, the issues with the controller containing the database is worse, because your models are more module (more models, more re-factoring).
HMVC doesn't necessarily mean more models. Using HMVC allows for portable modules from a project that can be access across multiple controllers. Often you will see Libraries doing this in non HMVC frameworks ie Library that doesn't some db/templating.
Thanks for the response Ken, I've updated my question with an example. Hopefully, the source of my confusion is clearer. Thanks again.
– timborden Aug 5 '10 at 13:11.
UPDATE: Just wanted to answer/comment on my confused question. Kohana provides a Modules folder that addresses my earlier concerns. For example, if you were to setup a domain, with a subdomain, using Plesk, the folder structure would be the following.
Httpdocs subdomains +--management +--httpdocs If you want to share code between the domain and subdomain, using Kohana's modules, you could setup your file system like this: modules system httpdocs +--application +--index. Php subdomains +--management +--httpdocs +--application +--index. Php Where httpdocs/index.
Php and subdomains/management/httpdocs/index. Php has the following: $application = 'application'; $modules = '/root/pathto/modules'; $system = '/root/pathto/system'; Any objects that are used in both the domain and the subdomain can be placed in the modules folder to be used by the application. Hope that helps.
I've been reading and learning about Object-Oriented programming (Head First Object-Oriented Analysis and Design and Code Complete: A Practical Handbook of Software Construction – thanks to suggestions found on StackOverflow). I've also been learning how to use a couple PHP MVC frameworks (specifically Codeigniter and Kohana). Some of the principals of Object-Oriented that I've read about are handled differently by the MVC frameworks.
I think I've managed to understand the differences and why the decisions were made (complete and easy to use solution), but I wanted to test my assumptions...so if you'll humour me...please comment or correct. Thinking about the right abstraction for a web application, the directory containing the library of classes should be located outside of the directory containing the presentation files. This organization adheres to the DRY ("Don't Repeat Yourself") principal allowing for multiple presentation folders (www.domain.com, management.domain.com, api.domain.com, etc.) to work with the same objects.
If all your classes are located outside of your presentation folders, then the models in your MVC implementation just use instances of those classes. If that's true, then the MVC framework is just a presentation class (the controller) that helps to manage the input (GET & POST requests), the response (models or instances) and output (views or templates).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.