OOP (course 3): Inheritance, Abstract Classes, Interfaces and other amazing things

Things are about to get crazy.

You've learned the basics (Course 1). Heck, you even mastered service objects, model objects and service containers in Course 2!

Now we're getting into the meat of OO:

  • Class inheritance!
  • What about abstract classes?
  • Introducing the "protected" visibility
  • What is an interface? How can I leverage them?

This stuff will start to separate you from a beginner OO developer to someone who can really understand and flex OO code. It's hard stuff. So let's get started.


Your Guides

Ryan Weaver Leanna Pelham

Questions? Conversation?

  • 2016-11-20 weaverryan

    Ok, all the challenges should be working again. Thanks for letting us know, and sorry for issues!

    Cheers!

  • 2016-11-20 weaverryan

    Hey Volodymyr Vadiasov!

    Ah, sorry about the issues! You're right - I can see some challenges failing to boot, that sucks! I'm working on it now - it doesn't affect all challenges, but may affect several of them. I'll update when things are smooth again.

    Cheers!

  • 2016-11-20 Volodymyr Vadiasov

    Hello,

    Challenge 1 is not working (1-4 lessons).

  • 2016-06-20 Victor Bocharsky

    Yes, it's a very cool to have strong knowledges about OOP in PHP. There're a lot of CMS, frameworks and simply well designed libraries are exist for today which are written using OOP.

  • 2016-06-20 Klemens

    As I studied informatics the world lives without OOP. Lateron coincidentally I didnt need it - but now (in times of Drupal 8) I'm very happy that with your guides I can "update" my knowlegde on a very convenient way ! Thanks a lot !

  • 2016-02-20 Syed

    Hey! If you're interested I decided to do just that. I've used the screencast as a foundation to learn stuff like composer and unit testing. https://github.com/sjhuda/knp-.... The master branch contain what I have so far. I'm still wet behind the ears when it comes to OOP so I'm happy to take on any suggestions.

    You'll see my composer.json has an autoload section with the namespace of the classes and the folder it lives in. In bootstrap.php I'm now just including composer's autoload.php (and db settings - but i'm going to move that into a .env file and hopefully do away with bootstrap.php). I had to go round each class and a namespace and look for any place I've used a class and include it at the top.

    I loved this series and I think the project is a great foundation to build up our php skills. Up next - unit testing!

  • 2015-12-15 weaverryan

    Thanks Neal!

    Ah yes: we'll create either an episode 4 for OO and include it... or maybe put it in its own mini-episode. It's not something you need to practically take care of anymore due to Composer (of course, as long as you know how to configure it), but it's still a fascinating topic and something good to know!

    Cheers!

  • 2015-12-15 Neal Ostrander

    Great Tutorials as always. Just wondering if at some point your going to update this one to show how to implement the autoloader for classes it is mentioned through out the videos but never implemented. Thanks

  • 2015-11-25 Hans Nieuwenhuis

    Hi,
    Just want to give You a BIG compliment on these tutorials.
    Really learned a lot and had a lot of fun !!

    Regards,
    Hans

  • 2015-10-24 weaverryan

    You're right - we talk about a lot of great things in this tutorial, but we're saving traits for the future. I've removed "traits" from the description for this tutorial

    Cheers!

  • 2015-10-23 A Maria

    Hmm, I don't see anything about traits here. Unless I'm missing something.