June 8, 200818 yr Hello, I am currently thinking of migrating to an OO coding style when developing in PHP however the only experience I have of OO Development is in Java, this means I have some knowledge of classes, methods, objects and inheritence. However I do not understand how it all works with PHP, I have a decent understanding of PHP. I was hoping someone good guide me to websites, books that could get me started as a newbie. Thank you very much
June 8, 200818 yr I found the PHP 5 Objects, Patterns, and Practice book a great starting block for OOP in PHP. It takes a while to get your head around the concept, but seeing as you've dabbled in Java you'll probably pick it up quickly.
June 8, 200818 yr What in tarnation is an OO style? Is that like when you're impressed with it and you say 'OOHH, PHP! That looks good'?..... Thought not. Care to share?
June 8, 200818 yr Hello, I am currently thinking of migrating to an OO coding style when developing in PHP however the only experience I have of OO Development is in Java, this means I have some knowledge of classes, methods, objects and inheritence. However I do not understand how it all works with PHP, I have a decent understanding of PHP. I was hoping someone good guide me to websites, books that could get me started as a newbie. Thank you very much I tried out some of PHP's OO features but there were 2 limitations: PHP OO does not compare with Java or C++ so the benefits are less likely to justify the extra work. Some of features (like static variables) only work with PHP5 and NOT PHP4. This is a problem since a lot of mature sites (ones that make money) still use PHP4. Other programmers with no experience of a language like Java are completely confused. What in tarnation is an OO style? Is that like when you're impressed with it and you say 'OOHH, PHP! That looks good'?..... Thought not. Care to share? OO = Object Oriented This helps with organising code in large programming projects and should mean less bugs. You create classes which can have methods and varibles. Then you create objecs which are instances of a class. Then your code can look like this: $myaccount = new Account('John Smith'); $myaccount->setBalance(1000000); $myaccount->pay('PayPal', 'me@me.com', 14000); $cash_left = $myaccount->balance;
June 8, 200818 yr It's basically a method of programming that really cuts down the chances of code duplication and overwriting. Plus it sounds funny to say
June 9, 200818 yr As a side question, I've just started learning PHP too - which would you recommend learning first after HTML/CSS, JS or PHP?
June 9, 200818 yr That completely depends on what you hope to do. Javascript and PHP do totally different things. If you want to develop larger apps with databases etc then you will need PHP, if you are more interested in functionality and adding gizmo's to your site then learn javascript. Personally, I have never "learnt" javascript, I learned PHP by fiddling with code and writing my own bits, and all of the javascript I've ever needed is out there on the web, I know enough to manipulate a similar script to do what I want to do. I find javascript has too many quirks to "learn", I mean I can code in C++, Java, C#, PHP, Perl etc but Javascript (and visual basic for that matter) have always gone over my head in some way... It just NEVER works the way you expect !
Create an account or sign in to comment