Skeleton Directories
Posted: Thu May 28, 2009 9:11 pm
On the devnetwork Skeleton project, I was trying to understand the directory structure.
- Why call it "A" when you guys call it Skeleton? Why not a folder named Skeleton?
- Why does everything have to start with "A_" in the framework classes? Why not call the classes like "Model::classMethod()", "Controller::classMethod()", "View::classMethod()", "Cart::classMethod()"?
- What is "specs" in the root folder?
- Why stick "sweety" (the template engine) in the root path?
- Why are "tests" in the root path?
- Where's your .htaccess file to load index.php for the front controller?
- Where's your bootstrap file to load common classes for the framework?
- You call it "Mapper", but I think the world calls it "Router". Why is that?
- In "examples" I find a front controller example. Why make that like an optional implementation? Why not just make it a default and if people don't like that they can choose to replace it? I mean, it makes it one more step one has to learn in order to use Skeleton.
- You appear to have common library classes in A, but then why also have "classes" there and "functions" there?
- Where's the class for controllers, for models, and for views as part of the mechanics of this framework?
- Why have a "Template" class when you appear to use "sweety"?
- Why are folders under "A" along with files? Why not a structure of Domain Object folders for the parts of the framework, and then files under that? I mean, let's take Validator.php. You could create a Validator folder and just put Validator.php inside. And if you need to grow Validator beyond one class, you already have a folder. It just is more logical to me.
- Have you all considered a file hierarchy like the following? The {x} means folder.
.htaccess
index.php
{controllers} (or _controllers)
{models} (or _models)
{views} (or _views)
{system} (or _system or _library -- stuff for the framework)
The .htaccess calls index.php for all unrecognized URLs (the 404 trick). It loads the index.php as the front controller. The front controller can be minimal here, doing nothing but loading the system\bootstrap.php file, and doing the default routing of any URL that comes in so that:
http://site.com/domain-object/task/whatever/whatever/
is automatically routed to:
controllers/DomainObject/Task.php and whatever/whatever can be parsed inside that.
The page controllers folder can be empty except for the controllers/Home/Home.php file which gets called if someone hits the site like so:
http://site.com/
The models folder can be empty and the Model::loadModel('DomainObject/SubDomainObject") class method can load stuff from models. Under models, for instance, I could create a folder "Employees" and then perhaps a class file like "Management.php". And then I could do Model::loadModel('Employees/Management') to load it in my page controller.
The views folder can be empty except for the Home/Home.php file which gets called automatically if someone does something from Home/Home.php like: View::displayView($sView) where $sView is either empty or says "Home/Home".
In the system folder, you can store the classes that handle controllers, models, and views, and then the classes that provide all the goodies in Skeleton like DB, Filter, Email, PDF, Pagination, Cart, Captcha, etc.
Just saying that with a more logical file structure, it might make it easier to understand and use.
- Why call it "A" when you guys call it Skeleton? Why not a folder named Skeleton?
- Why does everything have to start with "A_" in the framework classes? Why not call the classes like "Model::classMethod()", "Controller::classMethod()", "View::classMethod()", "Cart::classMethod()"?
- What is "specs" in the root folder?
- Why stick "sweety" (the template engine) in the root path?
- Why are "tests" in the root path?
- Where's your .htaccess file to load index.php for the front controller?
- Where's your bootstrap file to load common classes for the framework?
- You call it "Mapper", but I think the world calls it "Router". Why is that?
- In "examples" I find a front controller example. Why make that like an optional implementation? Why not just make it a default and if people don't like that they can choose to replace it? I mean, it makes it one more step one has to learn in order to use Skeleton.
- You appear to have common library classes in A, but then why also have "classes" there and "functions" there?
- Where's the class for controllers, for models, and for views as part of the mechanics of this framework?
- Why have a "Template" class when you appear to use "sweety"?
- Why are folders under "A" along with files? Why not a structure of Domain Object folders for the parts of the framework, and then files under that? I mean, let's take Validator.php. You could create a Validator folder and just put Validator.php inside. And if you need to grow Validator beyond one class, you already have a folder. It just is more logical to me.
- Have you all considered a file hierarchy like the following? The {x} means folder.
.htaccess
index.php
{controllers} (or _controllers)
{models} (or _models)
{views} (or _views)
{system} (or _system or _library -- stuff for the framework)
The .htaccess calls index.php for all unrecognized URLs (the 404 trick). It loads the index.php as the front controller. The front controller can be minimal here, doing nothing but loading the system\bootstrap.php file, and doing the default routing of any URL that comes in so that:
http://site.com/domain-object/task/whatever/whatever/
is automatically routed to:
controllers/DomainObject/Task.php and whatever/whatever can be parsed inside that.
The page controllers folder can be empty except for the controllers/Home/Home.php file which gets called if someone hits the site like so:
http://site.com/
The models folder can be empty and the Model::loadModel('DomainObject/SubDomainObject") class method can load stuff from models. Under models, for instance, I could create a folder "Employees" and then perhaps a class file like "Management.php". And then I could do Model::loadModel('Employees/Management') to load it in my page controller.
The views folder can be empty except for the Home/Home.php file which gets called automatically if someone does something from Home/Home.php like: View::displayView($sView) where $sView is either empty or says "Home/Home".
In the system folder, you can store the classes that handle controllers, models, and views, and then the classes that provide all the goodies in Skeleton like DB, Filter, Email, PDF, Pagination, Cart, Captcha, etc.
Just saying that with a more logical file structure, it might make it easier to understand and use.