Jump to content

To MVC or not to MVC?


cmgmyr

Recommended Posts

I've been reading up on MVC though some posts on here and some other site with tutorials on them. I also downloaded CodeIgniter and have been playing around with that a little. I was wondering how many people use these frameworks and why? I would rather make my own once I know how they work a little more, any insight on this? Pro's/Con's with using MVC?

 

Thanks,

-Chris

Link to comment
https://forums.phpfreaks.com/topic/74329-to-mvc-or-not-to-mvc/
Share on other sites

Well my code right now is structured well and is easy to maintain and reuse. Usually I have something like this:

 

/css

--style.css

/includes

--/classes

----class.mysql.php

----class.functions.php

----ect.

--/nav

----header.php

----footer.php

--includes.php <- this is to include all of the classes and config file

/js

--main.js

about.php

contact.php

index.php

 

but it's not as dynamic as it could be

Link to comment
https://forums.phpfreaks.com/topic/74329-to-mvc-or-not-to-mvc/#findComment-375567
Share on other sites

You've asked two questions.

 

1) Should I use a framework?

If you're more comfortable working in your own format/style, and don't mind implementing a lot of common, possibly tricky/difficult routines yourself then don't bother with a framework.

 

2) Should I try to organize my code along the MVC pattern?

Probably yes.  At least it's worth having a separation of concerns so that you can more easily make changes to one section without effecting another section of code.  A possible third question is how much separation?  I think the answer to that needs to be made case-by-case.  For most things you do less is probably enough.  If you anticipate many people working with the code you're writing then air on the side of more separation.

Link to comment
https://forums.phpfreaks.com/topic/74329-to-mvc-or-not-to-mvc/#findComment-375966
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.