Building a PHP Front Controller
Subject:   Not really seeing the point...
Date:   2004-07-13 11:25:10
From:   ionrock
Response to: Not really seeing the point...

The main reason I end using includes is for different actions. The obvious example would be inputting data into a database.

switch ($_GET['do']) {
case "forms":
include "myforms.php";
case "db":
include "handleinfo.php";

The issue is that for each and every action we are creating a file. The better solution is of course to make a common means of creating forms and a common means of handling form data using a class. My issue is that while a class to handle all types of data input and a class for creating forms seems to be useful and the most efficient, it also becomes very confusing if you needed to change forms. You edit a large class that might be difficult to understand after a few months or years. On the other hand finding the file with the forms and database input seems very simple. Where then is the advantage in using a class for this kind of action?

I understand this probably strays a bit from the article regarding patterns and a front controller but I think the root of the article and coding in general lies in creating easy to manage and efficient code. So really, I think the question is really how is the best way to handle a huge tree of options that a web app often takes.

Your comment does make a lot of sense with regard to producing content to the end user. I think my issues are more associated with creating the admin interface for adding content. That is where things seem to become much more complex (at least in my experience).

Thanks again for writing the article and if this is not the right forum for my questions/thoughts please don't hesitate to let me know. While I have worked with php for a while I am by no means an expert. I am really trying to learn more about large scale projects that are just too large to be handled using the same concepts as the smaller projects I have worked with in th past.