Tutorials

OOP (Object Oriented Programming) in 10 minutes

When I founded Coding Dojo in 2012 and taught students in our campus daily, teaching them how how to think in object oriented programming was difficult. After all, learning OOP and being really familiar with all the concepts such as what exactly a class is, what objects are, what it means to instantiate an object, what a constructor is, what the different types of attributes/methods are, what encapsulation is, how to create private method/attribute vs public and when to do each approach, what inheritance means and why it’s needed, etc, were concepts that were overwhelming for many who just learned how to code less than a few weeks ago.

After trying numerous analogies, students still seemed to struggle with really grasping these concepts. I have tried for months trying to crack this, as after all, OOP is one of the key core-building blocks of software, and it was important that students understood how to use OOP and what all the terms meant.

After numerous attempts and months of effort, I decided to use a new approach to explain OOP. This time, after my lecture at class, everyone understood the concepts and it was less than 20 minutes! I was surprised as this was the first time everyone in class understood all the concepts walking away thinking what they learned just seemed so simple and intuitive (this by the way, is when you know you cracked how to teach a difficult concept). I was so happy about this discovery that immediately afterwards, I created this video to teach OOP. Once this video was created, I put this video in our learn platform and afterwards, everyone in Coding Dojo (across all of our campuses) within 10 minutes walked away with clear idea of OOP fundamentals. Although the video could be updated, we kept it to this day to remember this teaching discovery. Now, we share this video to everyone hoping that if you were struggling with some of the OOP concepts, this would be helpful for you.

OOP in 10 minutes

Below shows how a simple class called a Student (with a public attribute called ‘name’ and a public method called ‘say’) is created with Javascript, PHP, C++, Java, Python and Ruby. Note how they have lots of similarities. As the comparison chart appears small, click on it to see it at a higher resolution.

OOP in Javascript

If you’re interested in how OOP is done through Javascript, you can go through Hacker Hero’s Advanced Javascript module. OOP in Javascript has some fundamental differences compared to other languages, especially as Javascript wasn’t really built for traditional OOP. These differences and subtleties are covered again through our Advanced Javascript module.

Concluding thoughts

OOP could be difficult but when presented this way, we think it’s digestable. It would still take some time for these concepts to be fully internalized, but we hope these two videos helped you get started on the right path.

If you liked what you’ve read, please share this post with others. If you know people who are just learning to code for the first time, sharing this resource could be helpful also.

Michael Choi
About author

Founder of Coding Dojo and Data Compass.

Leave a Reply

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