eZe616 Posted May 19, 2007 Share Posted May 19, 2007 Is it better to program with OOP or just plain non OOP programming? What are the advantages and such. I wanna start learning OOP but having a difficult time, so just wondering if it's worth knowing.. Quote Link to comment Share on other sites More sharing options...
utexas_pjm Posted May 19, 2007 Share Posted May 19, 2007 Is it better to program with OOP or just plain non OOP programming? This is, of course, a matter of personasl preference. What are the advantages and such. I wanna start learning OOP but having a difficult time, so just wondering if it's worth knowing.. It is deifintely worth knowing. OOP promotoes modular reusable code. OOP also allows you to model "real life" entities as objects and use them in the code as they would be used in the "real world". This makes OOP more intuitive in my opinion. I hope you do decide that OOP is worth learning, even if you decide not to use it I think you'll be better off as a developer after the exposure. Best, Patrick Quote Link to comment Share on other sites More sharing options...
johnrcornell Posted May 19, 2007 Share Posted May 19, 2007 The best response to this common question that I've heard recently is in this Zend Developer Zone article by Robert Peake: http://devzone.zend.com/node/view/id/1236 Quote Link to comment Share on other sites More sharing options...
Nameless12 Posted May 20, 2007 Share Posted May 20, 2007 This is, of course, a matter of personasl preference. No, its not personal preference.. Any OOP Programmer who discards functional programming because he has "Chosen to use oop" is an idiot. They should be used together, people should not pick one over the other. class: A grouping of related functions that share the same properties. OOP can just do lot of neat things it can do that cannot be done without them, figure out what they are because there is to much for me to list in this post. (there is that much) Quote Link to comment Share on other sites More sharing options...
utexas_pjm Posted May 20, 2007 Share Posted May 20, 2007 Any OOP Programmer who discards functional programming because he has "Chosen to use oop" is an idiot. I think you are looking for "procedural programming" --functional programming languages are languages like Haskell which use Lambda style function declarations and recursive defintiions. Patrick Quote Link to comment Share on other sites More sharing options...
Nameless12 Posted May 20, 2007 Share Posted May 20, 2007 What I said was wrong and innacurate but the reason I said that was when you compare functions with classes, I really dont see much of a difference in terms of the flow of the application, I dont see the difference because functions can use other functions inside a function and it uses different parts of the program, when most phpers talk about procedural I get the impression they are talking about Top to bottom apps if you understand what I mean. I shouldn't of said what I said, I just hate the term procedural because anyone who programs top to bottom like I think many phpers do is a beginner or an idiot. And the reason I think most phpers do this is because php is so popular and thats the way the majority of tutorials teach People talk about how oop is so modular as if somehow functions are not modular enough. Functions are heaps modular, but the majority of people programming in php dont seem to understand how to use them properly because they are optional unlike many other languages. I am ranting, anyway you are right what I said was wrong but it was to try and describe this rant in a shot way. Quote Link to comment Share on other sites More sharing options...
seddonym Posted May 22, 2007 Share Posted May 22, 2007 I was asking a similar question to you a few months ago. With the journey I have since taken I think it is definitely worth getting a good working knowledge of object oriented PHP, even as a beginner. Recently I made the jump into OOP programming through the book PHP5 Objects, Patterns and Practice by Matt Zandstra. The first part is particularly good at giving you confidence about how everything works - it assumes you understand procedural PHP but tells you everything about OOP PHP. It's also really good at giving you an idea about why OOP is so powerful. The other thing I would recommend is making yourself aware of using coding frameworks such as PHP Cake or Codeigniter. These are both PHP applications that you can use to write more complex sites, and they work using OOP. To use them, you need to be equipped with the basics of OOP. Using them didn't make much sense to me until I had read the above book. Good luck! Quote Link to comment Share on other sites More sharing options...
Jenk Posted May 24, 2007 Share Posted May 24, 2007 class: A grouping of related functions that share the same properties.Oh dear.. no wonder you can't see the difference :\ Quote Link to comment Share on other sites More sharing options...
Nameless12 Posted May 27, 2007 Share Posted May 27, 2007 class: A grouping of related functions that share the same properties.Oh dear.. no wonder you can't see the difference :\ You have miss read the intent of my words, when i said that I did not mean that I don't see the difference. I know oop quite well, I just don't think it is drastically different from procedural IN TERMS OF APPLICATION FLOW, I don't think anyone could ever say they are the same due to the fact oop has a lot of features that procedural lacks. However that said I still don't think it changes the flow of an application any more than how HOOKS change the flow of an application. Also classes are just a bunch of related data, just look at the php4 OO model and it is clear that is right. I see OOP as more then this, but I just thought it was a better way to put it in context to someone who is just starting out. 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.