MyBB Community Forums

Full Version: Getting into OOP, the MVC pattern and frameworks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
and the nice thing about OOP is the reuse of a class for multiple variables without overwriting an existing var or adding more vars for the other copies of something.

Using theGarfield's exmaple above you can do

$theGarfield = new MyName("TheGarfield");
$pavemen = new MyName("pavemen");

echo $theGarfield->displayName(); 
echo $pavemen->displayName(); 

all with the same include("theGarfieldClass.php") statement. So all the class variable names are the same but the container object name can be different. This makes it very easy to remember what you are working with and less var name changes.

They are also extensible, so look at the \inc\datahandler.php and see how the files in \inc\datahandler\* extend the base capabilities of the core datahandler object.
Just look at the MyBB code to see how it works.
^
OOP is the power :p
When I look back on scripts I've written in procedural PHP I feel disgusted lol.. As Matt said, when you go OOP, you never come back :d
(2011-12-31, 12:02 AM)TheGarfield Wrote: [ -> ]^
OOP is the power :p
When I look back on scripts I've written in procedural PHP I feel disgusted lol.. As Matt said, when you go OOP, you never come back :d

but remember, you don't always need OOP, so just be smart about when you use it.
Thanks for the input guys, much appreciated. I think I got the OOP thing covered. I'm rewriting an application I was working on in OOP and I can already see the advantages. It is just so much better. Smile

But I'm still not sure which MVC framework to choose. Yii's folder structure seems a bit simpler, but its size is fairly larger compared to CodeIgniter's (~11MB vs 4MB). Any comments on that? I'm just looking for a learning framework, not something future-proof. Honestly, it doesn't even need to be fast right now. I'll choose my own framework of preference in the future, when I actually need performance and a solid base to work with.
Are there any examples of major public projects using a framework though?

Example is like how MyBB 2.0 will use Yii.

Is there something like that anywhere? Because as much as I try to use a framework for something I just get nowhere fast. I never see any useful examples of end-user products built from a framework.

(2012-01-03, 05:37 PM)labrocca Wrote: [ -> ]Are there any examples of major public projects using a framework though?

Example is like how MyBB 2.0 will use Yii.

Is there something like that anywhere? Because as much as I try to use a framework for something I just get nowhere fast. I never see any useful examples of end-user products built from a framework.

http://www.pyrocms.com/ - built using CodeIgniter. I can't really think of any other really great examples, however.
It's a more recent popular thing. Most use their own frameworks but frameworks are becoming pretty popular. Like Burning Board uses its own framework (openly available though). IPB uses an in house framework as well I believe.

phpbb4 is going to be using a framework as well supposedly.

And, CMSs like Drupal and Modx kind of consider themselves frameworks as well.
(2012-01-03, 05:37 PM)labrocca Wrote: [ -> ]Are there any examples of major public projects using a framework though?

xF uses zend i think, and phpBB4 will use symphony
I don't like the idea of frameworks. I like to create applications with my own code, so I can be proud.
I completely agree
(2012-01-03, 05:51 PM)ThatHeart Wrote: [ -> ]I don't like the idea of frameworks. I like to create applications with my own code, so I can be proud.

Pages: 1 2 3 4