views:

48

answers:

3

hi, I'm tired of looking after a frame work for mvc implementation. i want to build a good MVC based structure of my own that will serve me in my projects. so here is my thinking I'd like to know what do you think. first of all. here is the folder structure:

The folder structure

the Admin and the Site folders:

I assume that the controllers/views in the admin/site and are totally different one from each other, so it is necessary that they will be in independent in each folder. if the autoload in the admin or site folder will not find a view/controller in its folder he will look for it in the MVC folder

the model, which is the db layer can be inside the MVC folder because it is shared to the entire project. a function like get_article_by_id can be used in the site and in the admin as well.

the MVC folder:

will hold the entire project models. and shared controllers/views.

the classes folder:

will be use as a framework folder, it will hold classes such as mailer,db that will implement php functions

How does that sound to you?

A: 

As long as you feel convenient with this structure - use it.

Dor
Well, how did i not think about it.Brilliant!
fatnjazzy
@bibi: Sounds trivial, but people tend to complicate things. Recall the "Keep It Simple" principle.
Dor
+2  A: 

Part of the benefit of using a popular framework is that other people know it and can help you with it. If you write your own, only you know about it. There is an MVC framework in almost every language and lots of thought has gone into each one, which means you get the benefit of a lot of experience by selecting an existing one, rather than writing your own.

Sohnee
A: 

If you need to ask advice about whether your reinvention of the wheel is any good then it's probably not better then the wheels already in existence.

A wheel inventor that knows he has a better wheel wont need to ask advice.

cottsak
I think that it would be better to *try* to reinvent something and understand why you failed, rather than instantly jump on the bandwagon.
Dor
i guess if you have the time the learning experience might be useful. my suggestion is really for production projects, where most of us dont have the time to invent things like mvc frameworks. generally you want something tried and tested. that's where the motivation for the statement came from
cottsak