0

I am new to PHP but have good OOP idea. I am looking for a good PHP book the Guides to Develop Website in OOP Style. I have purchased some books that all use Procedural approach to develop the website, or there are few book that show OOP chucks not a complete Webdevelopment Guide.

I need some book(source) that leeds me from Start 2 End of a website in OOP fashion.

hakre
  • 193,403
  • 52
  • 435
  • 836
user160820
  • 14,866
  • 22
  • 67
  • 94
  • 2
    http://michaelkimsal.com/blog/php-is-not-object-oriented/ I'm not saying it's an absolute truth or anything but just for you to have in mind (and of course you asked for an OOP **approach**) but I thought I might bring it up. – Trufa Dec 16 '10 at 13:46
  • 1
    http://stackoverflow.com/search?q=php+books – Gordon Dec 16 '10 at 13:49
  • I don't know if I can call it a duplicate but these sure touch the same subject. You might want to check these http://stackoverflow.com/questions/1707222/learning-php-oop http://stackoverflow.com/questions/249835/book-recommendation-for-learning-good-php-oop http://stackoverflow.com/questions/1557691/good-training-sources-for-oop-php-anyone http://stackoverflow.com/questions/1946047/are-there-good-tutorials-on-oop-with-php http://stackoverflow.com/questions/1870177/how-do-i-get-out-of-the-habit-of-procedural-programming-and-into-object-oriented – pavanred Dec 16 '10 at 13:50
  • http://stackoverflow.com/questions/90924/what-is-the-best-php-programming-book – Stephen Curran Dec 16 '10 at 13:50

3 Answers3

4

The comments above touch-base on this, but I figured I would give a definite "answer" to your question.

The reason you have been having trouble finding a book that shows how to code PHP in an OOP fashion, is that it isn't capable of being programmed that way. At least not alone. PHP is a hybrid language that can do objects, but doesn't have to do objects.

Now, there are a LOT of PHP frameworks out there that help reinforce OOP standards in PHP. It is here that you may find books that are more OO-centric. But any book out there that claims to teach raw OOP PHP isn't worth reading.

If you learned OOP first, as more than a few people are doing today, you have a hard road ahead. You are going to need to unlearn what you have learned about Objects to be able to get PHP. It is a mix. It is a cobbled-together mass of everything in one giant pot.

This power comes at the sacrifice of formality and standards. OOP is about sacrifice of power for formality and standards.

Good luck.

EDIT

To expand on how PHP is not OO alone.

What I mean is that, as I said later in the answer, using a framework that helps enforce OOP principals can make PHP function like other OOP languages, or at least more closely like it.

I should also clarify my C++ not being OOP comment. C++ is in exactly the same boat as PHP, only it has been around long enough that OO has become a true standard and is well-practices throughout the industry at large. PHP doesn't have this. There are almost no strictly OO large-scale applications built in PHP. Working with strict OO standards in PHP on the high-end will grind your application to a hault.

Compare with real OOP languages/frameworks. Ruby, Smalltalk, so on. Or even almost-totally OO languages like Java and C#.

DampeS8N
  • 3,621
  • 17
  • 20
  • 1
    Can you expand on what you mean "at least not alone"? I write all my code in an OOP fashion without any frameworks. – kieran Dec 16 '10 at 14:15
  • You do? What is your code entry-point? Don't confuse framework with framework-not-made-by-you. You undoubtedly made your own framework. – DampeS8N Dec 16 '10 at 14:21
  • Probably something about the language having primitives that aren't objects... but so does C++ so the point is kind of moot. – Ben L. Dec 16 '10 at 14:28
  • Sorry Ben. C++ is just as not OO as PHP is. Not a moot point at all. Languages that are OO are oriented to objects. It is perfectly possible to code C++ without a single object. – DampeS8N Dec 16 '10 at 14:31
1

I would recommend this book:

Matt Zandstra - PHP Objects, Patterns and Practice, Third Edition

It is largely OOP focused, at the same times it sheds light on the shortcomings/limitations of OOP in PHP.

cruizer
  • 33
  • 5
0

"Object-Oriented PHP" is a book: http://objectorientedphp.com/

Ben L.
  • 786
  • 7
  • 15