OOP for procedural programmers [closed]
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionate开发者_运维技巧d answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this questionI've been tied to several procedural applications written in PHP over the past 10 years. Two of these are going away soon, and I need to get up to speed with OOP techniques.
Are there good tutorials or books written for people who are skilled procedural coders? By skilled, I use functions heavily, and classify functions via different include files. I like clean, easy to follow code (and document accordingly). My brain has been trained to think procedurally, though experience taught me to break down code into re-usable parts (easier to maintain and update). I understand OOP is based around the same idea, but I need some help overcoming the hurdle of learning this new (to me) technique.
I was in the same situation and I started to use a CodeIgniter. It naturally guided me into oop (and I LOVE it).
...so by using the CI tutorials I personnaly think you can reach your goals.
hth
Perhaps you should look at 'PHP Objects, Patterns and Practise' by Matt Zandstra, 3rd Edition. I actually dislike the writing style of the book; it introduces difficult concepts in a hard-to-digest manner and then expects you to be forever comfortable with them when discussing the books' later material. Nonetheless, with some work, it will certainly help take you far beyond the ubiquitous example of a Shape base class being extended by 'Triangle' and 'Square' children (etc). It is aimed at procedural PHP programmers, so it may be very useful for you.
Martin Fowler's 'Patterns of Enterprise Application Architecture' is also given high esteem although it demonstrates its code examples in Java and I have never read it myself.
I've never read it myself but I've heard that Head First Java is a good book to learn OOP principles and might be helpful to you http://www.amazon.com/Head-First-Java-Kathy-Sierra/dp/0596009208
This book should be good for you http://www.amazon.com/Object-Oriented-Analysis-Design-Applications-2nd/dp/0805353402 (I've read only the first edition).
I'd advise you to keep away from php-specific books and online tutorials, because most of them are sheer rubbish.
精彩评论