PaulRyan Posted August 2, 2012 Share Posted August 2, 2012 I've been developing with PHP for about 6-7 years now, since I was around 13-14. I've always used the procedural coding style when ever I've undertaken a project, whether it be for myself, or freelancing. I've read up on OOP and it's advantages/disadvantages and whatnot, but I just cannot grasp how it can be used effectively. As far as I see it, its a bunch of functions wrapped in a class, which is loosely similar to just normal PHP functions within procedural coding. Why would someone use OOP over procedural? I would like some individual input on this, because I would like to better my knowledge of OOP and maybes start using it for future projects of my own, till I am comfortable enough to use it for freelance work. Just looking for your insight to the benefits of OOP, and your honest opinion on whether its worth learning and why. Thanks in advance, Paul. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 2, 2012 Share Posted August 2, 2012 I've read up on OOP and it's advantages/disadvantages and whatnot, but I just cannot grasp how it can be used effectively. As far as I see it, its a bunch of functions wrapped in a class, which is loosely similar to just normal PHP functions within procedural coding. You can't have done much reading then. Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted August 2, 2012 Author Share Posted August 2, 2012 Admittedly, I haven't read as much on it as I have wanted, mainly because I don't see the advantage of using OOP. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 2, 2012 Share Posted August 2, 2012 Your signature seems apt :-P Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted August 2, 2012 Author Share Posted August 2, 2012 Well spotted, but I'm asking for your opinions on OOP, not your opinion on my post, or my current research (or lack of). I don't want to waste time researching something that I feel wouldn't benefit me, if someone had a few valid points as to why they use it, or prefer it, then it would lead me to look into it more. Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted August 2, 2012 Share Posted August 2, 2012 As far as I see it, its a bunch of functions wrapped in a class, which is loosely similar to just normal PHP functions within procedural coding. That's because online tutorials are generally shitty and hardly ever show why OOP can be efficient and flexible. Instead, they begin and end with syntax and canned examples like a Cat class deriving from an Animal class. Get Matt Zandstra's book, then the Gang of Four's book. They will illustrate real world examples (especially the GoF book). Suffice it to say that there's a reason why OOP skills are generally required by professional grade dev shops. Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted August 2, 2012 Author Share Posted August 2, 2012 That's because online tutorials are generally shitty and hardly ever show why OOP can be efficient and flexible. Instead, they begin and end with syntax and canned examples like a Cat class deriving from an Animal class. Get Matt Zandstra's book, then the Gang of Four's book. They will illustrate real world examples (especially the GoF book). Suffice it to say that there's a reason why OOP skills are generally required by professional grade dev shops. I will definitely have a look at those, I agree most of the online tutorials aren't the best, they never were for prodecural either. I have wanted to have a look into OOP for sometime, but could never bring myself to spend the time researching and learning if it wasn't going to be beneficial, when it could be time spent working. Quote Link to comment Share on other sites More sharing options...
scootstah Posted August 2, 2012 Share Posted August 2, 2012 Some of the benefits of OOP are: - encapsulation - polymorphism - code reuse - abstraction - modularity For very small projects, OOP may not seem to have any benefit. In fact, it might be worse - by over complicating the problem. In my opinion, this is an excellent book on OOP, and how it applies to PHP. Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted August 2, 2012 Share Posted August 2, 2012 In my opinion, this is an excellent book on OOP, and how it applies to PHP. Yeah, that's Zandstra's book. Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted August 2, 2012 Author Share Posted August 2, 2012 Thanks Scootstah and KevinM1 for your insight input, will take heed of your comments Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.