Jump to content

Recommended Posts

Ok, so I've read a few tutorials of OOP and have a basic understanding of how it works but where is it generally handy? I have a basic site created with PHP that consists of a form that submits data to MySQL and then lists the data from the MySQL database on another page. Kind of like a little online planner. I don't see how me converting my site to use OOP would help here.

 

Maybe it's best for more complex situations such as a shopping cart where data needs to be shared across multiple pages?  :confused:

Link to comment
https://forums.phpfreaks.com/topic/231532-getting-my-head-around-oop/
Share on other sites

OOP is the dominant paradigm for non-trivial projects.  This doesn't mean that the same results couldn't be achieved using procedural, or even purely functional code.  The 'point' of OOP is to create systems that are flexible, modular, easy to update, edit, and maintain.  Objects, when created and used well, have a natural tendency to do this.  Well-formed objects are innately encapsulated, which protects them from being inadvertently changed by something outside of them.  It also allows them to be used in a multitude of contexts.  This combination therefore allows many objects to be pluggable, giving any system a great deal of flexibility.

 

All that said, OOP isn't objectively better than any other style of programming.  It's not necessary to learn if you're a hobbyist.  There's a lot of overhead in getting a system to fit OOP, and that overhead may not be appropriate for a project that won't grow substantially.

 

Unless you plan to develop professionally, there's no need to learn OOP.

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.