Jump to content

OOP?


eZe616

Recommended Posts

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

Link to comment
Share on other sites

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)

 

 

 

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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!

 

 

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.