Forum Moderators: coopster

Message Too Old, No Replies

MVC - Procedural or OOP . What's the better way?

         

neophyte

4:39 pm on Dec 3, 2006 (gmt 0)

10+ Year Member



I've been looking around the web for information on how to build my own MCV framework and mostly see these tutorials using OOP. I've yet to see any done via procedural methods except a very brief example - which is really just a simple page controller - in phppatterns.

This indicates to me that an MCV implementation is better suited to OOP ... problem is that I've been a purely procedural guy and don't know if I can spare the time learning the OOP side just yet.

So, can an MCV framework be accomplished efficiently using the procedural route (and if so, can someone sticky me a url that I can take a look at?) or is OOP the only way to go?

Neophyte

neophyte

4:41 pm on Dec 3, 2006 (gmt 0)

10+ Year Member



Ah, sorry... meant to write "MVC".

eelixduppy

2:15 am on Dec 4, 2006 (gmt 0)



OOP is probably the best way to go, but why do you want to create it from scratch when there are pre-made solutions out there?

SourceForge [sourceforge.net], phpclasses [google.com], Google Search [google.com].

In any case, I wish you luck! :)

pixeltierra

7:02 am on Dec 5, 2006 (gmt 0)

10+ Year Member



I was procedural for a long time but it became an obstacle. OOP is the way to go. If you use CSS perhaps you'll understand the following analogy:

OOP is to procedural

as an

external css class file is to the html code MSWord produces

I've learned that it's not about style, it's about levels of order. I also used to prefer to write my own code all the time, because it seemed that learning to use someone else's took me more time than writing it myself. I've now learned the error of my ways and see the benefit of being part of a coding community that uses "conventions", and is regularly enhanced.

OOP is not really that hard, and makes a lot of sense intuitively if you've coded for a while. As I learned I kept saying WOW!, I wish I new this before.

I recommedn you read some tutorials on OO PHP, and then read the Code Ignitor manual. See what you think. In coding I think the community approach, like in real life, always beats out the go-it-alone approach.

neophyte

2:41 pm on Dec 5, 2006 (gmt 0)

10+ Year Member



eelixduppy and pixeltierra - thank you for your responses.

Basically, I want to do this myself so I know what's going on ... and I've been interested in learning PHP/OO for a while but am terrified by the (perhaps perceived) learning curve I'll no doubt have to undergo.

After reading a bunch about it (in generalities) it appears that OO is the way to accomplish my task as well as move into larger applications as time goes by.

But, like my very first skydive many years ago I'm both eager and apprehensive. I'm really a graphic designer (23 years now) by trade but enjoy coding and have learned that I need to extend my skillsets just to keep the bills paid as I'm an american expat living and working in Southeast Asia.

My locale is another problem for me - there's not much around here in the form of user-groups from which I may ask the most basic of questions to keep my head straight on this new track. That being said (and yes, I did google "php oo tutorials" and other variations of the same) can anyone recommond any very basic on-line tutorials on OO which is gentle on jargon and rich in leading beginning learners like myself by the hand? The search results I came across made my eyes start to glaze over.

Neophyte

eelixduppy

8:02 pm on Dec 5, 2006 (gmt 0)



>>>can anyone recommend any very basic on-line tutorials on OO

Here's a few:
Classes and Objects (PHP 5) [us3.php.net]
The PHP Anthology Volume 1, Chapter 2 - Object Oriented PHP [sitepoint.com]
Google Search [google.com]

Best of luck!

neophyte

11:37 pm on Dec 5, 2006 (gmt 0)

10+ Year Member



eelixduppy -

Thanks for the links - actually I stumbled across the sitepoint article late last night and am continuing to study it.

Neophyte

eelixduppy

11:42 pm on Dec 5, 2006 (gmt 0)



Definitely study it, but try it more ;)

henry0

11:45 pm on Dec 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We have somewhere a section with books
I would like adding to that section:
the second edition (PHP5, OOP) of the " PHP COOKBOOK"
I guess we all know where to find it :) (I mean the book)
This edition is somehow advanced.

jatar_k

12:27 am on Dec 6, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> I was procedural for a long time but it became an obstacle.

you're really trying to wind me up aren't you ;)

I'll leave you to your little OOP chat

by the way, anyone ever seen Annie get your gun [google.com]? hehe

pixeltierra

5:41 am on Dec 6, 2006 (gmt 0)

10+ Year Member



>>you're really trying to wind me up aren't you ;)

I missed the joke. I hope something I said didn't offend you.

mcavic

9:12 am on Dec 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I missed the joke.

I think it's just that some of us have never seen the need for OOP. :)

jatar_k

7:35 pm on Dec 6, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> some of us have never seen the need for OOP

exactly :)

coopster

8:11 pm on Dec 6, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



LOL!

pixeltierra, you'll have to do much more than that to offend jatar_k.