tags:

views:

190

answers:

5

Hi there

I've started to learn OO programming, but using the PHP language with the help of the "PHP 5 Objects, Patterns, and Practice" book. The thing is that I wish to learn to use into same time the CakePHP framework which make use a lot of the MVC pattern. Because I don't know much about OO and less about MVC I wish to understand the later one but assumptions I make with my OO knowledges might have bad impact on long term.

Does anyone know a good tutorial about what means MVC (more than cakephp manual says about it, but more easy to read/understand than wikipedia)?

TY

A: 

You really need to understand OOP first before particular OO design paradigms like MVC. Also I would suggest using ruby or java to learn OOP as PHP's OOP is pretty nasty in its syntax.

ewanm89
MVC isn't an OO design paradigm, it can also apply to procedural languages without OO features. Also your comment about php is purely subjective and not helpful.
elias
Ask the PHP developers and even they will tell you they don't like the OO syntax.
ewanm89
I agree. OOP syntax in PHP is awful.
topright
+4  A: 

Here is an excellent PHP MVC tutorial on phpro.org to get you started.. I had trouble with MVC design pattern too but after reading this tutorial, I learned so much that I went on creating my own PHP MVC framework. (and yes I have re-invented the wheel but guess what, I learned a looooot and that was my primary reason).

Although you are already reading a book related to PHP OOP but yet I would recommend you going this great OOP tutorial at phpfreak

Sarfraz
+2  A: 

If you are just looking to find out more about MVC, why not checkout a book on design patterns? Since MVC is just a design pattern, most pattern books will contain it and much more. Design pattern books are a good read if you are starting on OO topics as well. You could checkout Martin fowlers online pattern catalog or checkout a book like Headfirst design patterns

Mark Story
headfirst design patterns is an awesome book
Galen
A: 

PHP has very bad OOP model. If you want to learn OOP, better start with simple and clean Java, and if you want to rock & roll, try C++. :)

OOP was added to PHP as a 5th leg to the dog. Of course, use it, it is very useful in web projects, but has some conceptual and syntax dissadvantages.

topright
A: 

Php Objects, Patterns and Practice is a bit of a tough entry point for OOP. It was my first source on the subject too, and after the initial grounding it's quite dense. Having said that, I keep coming back to it again, and again, and again - it's a definitive text for PHP OOP IMO, just hard to get started on.

I found Aaron Saray's book on PHP Design Patterns - and it's excellent. It takes all those abstract examples from the book above and shows you how you might implement them in your daily job. It lacks some of the detail and theory of the former - but complements it well.

http://www.wrox.com/WileyCDA/WroxTitle/Professional-PHP-Design-Patterns.productCd-0470496703.html

MVC - (or rather Front Controller) is a bit of a monster to try and grasp at first - it's better to play with a framework before tackling that. Page Controller is a better introduction to the MVC concept.

http://www.phpwact.org/pattern/page_controller

I agree that PHP OOP is "dirty", but hey, VHS wasn't as good as Betamax, and you can adequately learn OOP concepts in PHP (and deploy them on a webhost...) - although I would suggest that Ruby is probably simpler to grasp than Java (not that I've learn either, just dabbled with both)

sunwukung