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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.