Chris.P Posted March 23, 2011 Share Posted March 23, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/231532-getting-my-head-around-oop/ Share on other sites More sharing options...
MrXHellboy Posted March 23, 2011 Share Posted March 23, 2011 It could be easier, less writing, if you do it right and the style is quite pretty. If you learn how to do it, you will get the point of it. But you could reach the exact same purpose with procedural style Quote Link to comment https://forums.phpfreaks.com/topic/231532-getting-my-head-around-oop/#findComment-1191479 Share on other sites More sharing options...
KevinM1 Posted March 23, 2011 Share Posted March 23, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/231532-getting-my-head-around-oop/#findComment-1191498 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.