nov21 — 2012-12-05T15:01:54-05:00 — #1
For those of you who are familiar with this book, or those of you who could chip in: This book teaches you how to write database-driven websites in a procedural programming style. I was wondering how everyone around here views this, and if badly, do you know of a book that teaches the same thing but with more OOP? Which is something I spent a good deal of time on acquiring, and feel like is going to waste. Albeit I could always build websites this way that call class libraries written in an OOP way, I'm just wondering if you guys had any opinion on this matter. Thanks.
system — 2012-12-05T15:04:30-05:00 — #2
I'd go OOP all the way, personally. I tend to dislike it when I have to deal with old fashioned procedural code.
This is a good book for OOP design patterns and general good use of OOP in php: http://www.amazon.co.uk/PHP-5-Objects-Patterns-Practice/dp/1590593804
nov21 — 2012-12-05T15:12:00-05:00 — #3
Yeah, I sort of felt like I was wasting my time when I realized that he was going to write the code like this, but wasn't sure whether this was a common/good way to go or not. But yeah, I already spent a good deal of time learning about OOP in PHP - I was looking for something like this. Something that's specific to creating database-driven websites with PHP & MySQL. Is that involved in that book?
tpunt — 2012-12-05T15:20:19-05:00 — #4
If you don't know how to create database driven sites with procedural PHP already, then this book will help introduce it to you. Provided you feel comfortable with procedural code, then by all means start delving into the object-oriented paradigm. I personally would not recommend buying the edition of the book that aaarrrggh posted above, but rather the third series of that book because it is newer (by five years or so) and so will cover the likes of PHP 5.3 (with its new features, such as late static binding): http://www.amazon.co.uk/Objects-Patterns-Practice-Edition-Experts/dp/143022925X/ref=dp_ob_title_bk. I am half way through book at the moment, and so far it has provided me with a very strong foundation in object-oriented programming.
system — 2012-12-05T16:48:08-05:00 — #5
Good call! I hadn't realised I'd posted to an older version of the book. Sorry about that.
Yeah, it's a very good book. I've had it for a few years now (mine will be either the first or second edition), and I still refer to it quite a bit. I would say that it's quite dense and sometimes things didn't quite "sink in" for me straight away, but over time I've gained an awful lot from it.
The moment objects really clicked for me was the moment where I used polymorphism in a real live environment for the first time. That was my first eureka moment, because before that I'd been using classes but wasn't writing true object oriented code. From there I got really into using interfaces and abstract classes (for a year or so of using OOP, I couldn't understand why anyone would want to use an abstract class or an interface, but then after finally seeing the light with polymorphism it started to make sense to me). Now I can build systems that can adapt easily over time and that are much easier to test, but it took a lot of time, effort and bad code before I finally got there.
I'm still not finished of course. I learn new stuff every day, and I'm sure if I posted some of my current code up here, there'd be some clever people around here that could make it better, but I've got much better over the years, and this book was one of the tools I used to get me there...