Jump to content

Recommended Posts

Hi, I'm relatively new to programming in general. PHP is the first language I've learned.  I'm not trying to make a career of this or anything.  I'm designing a browser game with my wife, but it's more for fun and the game design/art design experience (something I do plan on making a career of eventually).  Sorry if this is too much background, but I'm trying to give you an idea of where I'm coming from with this question.

 

So I'm on the brink of really getting into moving from the design phase into the heavy programming phase and I'm trying to decide how best to approach everything before I spend forever working on it.  I've heard a lot of hype about OOP, and I've got the very basic basics down, but honestly, I don't really see the advantage of it when I'm gonna be the only one working on this.  It seems like far more trouble than it's worth.  And then I thought, 'Well I'll just try it anyway because everybody swears it's the best way to go,' but I've found that it's a lot more awkward for me to deal with - either I'm not getting something or my brain just doesn't work that way.

 

Can't I achieve the same reusability and modularity by using includes/requires? Why is OOP really better, functionally speaking? Because these abstract notions of why it's better theoretically don't seem to apply to how I operate...

Link to comment
https://forums.phpfreaks.com/topic/150076-is-oop-really-better-than-procedural/
Share on other sites

You have obviously read about the benefits of OOP, so I won't bother reiterating them for you. However, considering you said you're new to programming in general, I'm automatically assuming that you're doing OOP the wrong way. No offense, you may have got it right, but my experience is just that a lot of people who are new to it starts just grouping their functions into classes and then call it OOP. It's not, they're just using the classes as a kind of name spaces.

 

Obviously, I cannot tell if your code is good or bad without having seen it, but my personal experience is that OOP done right is superior in terms of some of the benefits you already mentioned.

If you are the only person working on the system then you can make it entirely how you wish.

 

In another scenario where a developer may work on many systems providing upgrades, extra features, bug fixes then an OOP design is favoured.  For example I may create a blog feature for a website that logged in users can view. With an OOP system I can add the components without affecting any of the underlying code so I know I am not creating bugs in the rest of the system. In a procedural system I may need to add extra code to files / functions that are live and potentially create bugs in the system that affect the users.

 

When deciding on OOP or procedural I ask myself the following questions:

1. Is it just myself that will be working on the system

2. Is the system fixed or is it likely that the client may ask for large modifications, extra features

3. Is the system likely to be ported to other servers or other types of database servers

4. What is the deadline for system completion

OOP means object-oriented-programming. PHP is OOP, no matter how you use it. So when you talk about using OOP with PHP, it sounds stupid. It's like double OOP, which makes no sense.

 

Am I missing something here?

 

Dear lord...

PHP is OOP, no matter how you use it.

 

No it is not!

 

Yes, it is. Look it up. PHP is an Object-Oriented Programming language (OOP). Quick reference: http://en.wikipedia.org/wiki/Object-oriented_programming_language

 

Buddy, you don't know what you are talking about. You don't even know what OOP is according to your last post. Leave it.

Yes, it is. Look it up. PHP is an Object-Oriented Programming language (OOP).

 

PHP is an Object-Oriented Programming language if your programming code is based around the OOP concepts in PHP. PHP applications can also be procedural.

 

I don't think you understand the concept of OOP. Do some more research.

I see it on PHP's website. It's here: http://us.php.net/oop - I looked on another few websites, too, for a better definition of it. The funny thing is, I use this style of coding a lot.  :D - I always just referred to it as classes though... Now I feel completely embarrassed.  :-[

PHP is OOP, no matter how you use it.

 

No it is not!

 

Yes, it is. Look it up. PHP is an Object-Oriented Programming language (OOP). Quick reference: http://en.wikipedia.org/wiki/Object-oriented_programming_language

 

Buddy, you don't know what you are talking about. You don't even know what OOP is according to your last post. Leave it.

 

I thought you guys were referring to a different acronym, because of the post below:

If you are the only person working on the system then you can make it entirely how you wish.

 

In another scenario where a developer may work on many systems providing upgrades, extra features, bug fixes then an OOP design is favoured.  For example I may create a blog feature for a website that logged in users can view. With an OOP system I can add the components without affecting any of the underlying code so I know I am not creating bugs in the rest of the system. In a procedural system I may need to add extra code to files / functions that are live and potentially create bugs in the system that affect the users.

 

When deciding on OOP or procedural I ask myself the following questions:

1. Is it just myself that will be working on the system

2. Is the system fixed or is it likely that the client may ask for large modifications, extra features

3. Is the system likely to be ported to other servers or other types of database servers

4. What is the deadline for system completion

 

Thanks for clearing this all up for me, guys!  ;D

 

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.