Jump to content

OOP or procedural coding - MVC


n3p3

Recommended Posts

Why we/you use OOP instead of procedural coding while constructing the backbone of the site? In MVC pattern, we only use once this "controller" class, and also the so-called base class is actually a collection of generic functions. And derivatives of that are again adds some functions and uses some of those generic functions. So instead of creating a differen derivative of controller object everytime(where we again need to include the class' definiton file) we can simply include the needed file and call the needen function. Again in this general controller-view structure.

Link to comment
Share on other sites

I personally use both to power my sites.

 

Everything that could possibly be contained within as a class/object that could be used more than once (or transfered to another system) I place within a Object. Things like form creators that handle every aspect of creating forms for me. Or my image class that can resize, crop, and thumbnail any type of image. These things make great objects because then I can use them anywhere in my code or even rip them right out and move them to another site without re-coding anything.

 

But the procedural coding is used on the index page to load all objects and run them and return the output of all the plugins, functions, and classes.

 

Hand-in-hand - the best of both worlds ;)

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.