Friday , 17 November 2017
Home / Programming / PHP / Conclusion – PHP OOP Tutorial
Conclusion
Conclusion

Conclusion – PHP OOP Tutorial

This tutorial is a part of the PHP OOP tutorial series. If you would like to view the complete list of tutorials under this series and the order you should follow, then click here. http://jaskokoyn.com/php-oop-tutorial-series/ 

This is the final tutorial. You now have a basic grasp on what object oriented programming is and how you can apply it to PHP. There’s more to it such as design. If you would like more information, then go here

.http://php.net/manual/en/language.oop5.php

One question, that I’ve been avoiding during this whole series is why use object oriented programming? Why use constants, interfaces and all these complex terms in general?

Why?

The purpose of object oriented programming is to have code that is structured and organized. For the most part, you’ll find yourself in situations where you’ll be reusing code. Instead of having to recreate that same logic for each project, you can have a class that does most of the work for you.

Another reason for having such strict concepts is because you may end up sharing your class. For example, let’s say you had a database class. A lot of people connect to databases. Some people may be looking for code that can help them connect to a database easier and run certain functions. By creating your database connector as a class, you help prevent collisions in their own program because all code wrapped in a class is unique to the class only.

By defining your classes as public or private, you also prevent developers from ruining the functionality of your class. Of course they can just go into the class itself and change things around, but then they would be destroying the purpose of object oriented programming. What if your class updates? They’ll have to do it again and again. You’ll find yourself using other developer’s classes and knowing OOP will make you a better programmer.

Conclusion

You don’t have to use every single concept for your classes. It’s really up to you, but please utilize what you can to help make your code perform better. You don’t have to use classes for all your projects. It really depends on you and how you wish to use it. The basic rule is, if you’re doing the same thing over and over again, then you should probably create a class for it.

About Jasko Koyn

Check Also

Static Methods and Properties

Static Methods and Properties – PHP OOP Tutorial

Let’s learn how to create static methods and properties. Anything that’s static is basically something …

5 comments

  1. i would love to see more posts like that, you really know what your talking about!
  2. Thanks was really helpful. Good start for me to understanding OOP with PHP.
  3. Thank you.
    You have a rare gift of speaking in a simple way about difficult things.

    These tutorials are like lightning that enlightens something that have been obscure so far.
    One catches the idea and got it – i hope forever.

    Please write more about i.a. PHP OOP

  4. Thanks was very helpful.
  5. You are wonderful

Leave a Reply

Your email address will not be published. Required fields are marked *

ULTIMATE WORDPRESS DEVELOPMENT COURSE
Want to learn how to create your own custom WordPress plugins and themes? Check out my course!
Get 93% off my course. You'll also learn how to integrate WooCommerce and BuddyPress into your projects. This is a limited time offer
Yes, I would like to get 93% off your course!
No Thanks!
close-link