Tech Elevator Week 3: “The 4 Principles Of Object Oriented Programming”

It’s mind-blowing what I’ve learned in three short weeks at Tech Elevator.

Week 3 topics:

  • Monday: Inheritance + Resume Presentation

  • Tuesday: Polymorphism

  • Wednesday: Inheritance Part 2 + Side Project Presentation

  • Thursday: Unit Testing + Resume Workshop

  • Friday: Test-Driven Development + Panel Presentation: “Lessons I learned in My IT Career”

Recently we’ve been focused on object-oriented programming (OOP). The four principles of OOP are abstraction, encapsulation, inheritance, and polymorphism.

object.png


A Simple Explanation

Abstraction

Imagine starting a car. You turn a key or push a button and the engine starts. Everything works, but you don’t need to understanding what happens under the hood.

Abstraction in software engineering means exposing only the essential mechanisms while hiding the irrelevant detail from other parts of the application.

abstract.gif

Encapsulation

Your circuit breaker is an example of encapsulation. When one circuit trips you can still have power in the rest of your house.

Encapsulation means binding data with the code that manipulates it. This modular approach makes code easier to test and maintain.

encapsulation.gif

Inheritance

Cars, trucks, and motorcycles are all subclasses of vehicles. Sedans, minivans, and hatchbacks are subclasses of cars.

Inheritance means objects exist in a hierarchy that can pass on properties and methods. Inheritance allows developers to reuse code and therefore write less of it.

Polymorphism

Polymorphism means “many forms”. 

Let’s say you want to compare the area of different shapes such as circles, triangles, and squares. They all calculate their area with a different formula.

However, if they inherit an abstract “getArea” method from an interface, they can be grouped together in a list because of this shared method.

polymorphism.gif

Hopefully now you have high level understanding of the four principles of object-oriented programming! Do you have any questions for me?

Thanks for reading my latest post documenting my transition to the tech industry. This is week 3 of 14. I hope you’ll check out my previous posts and come back next week.

Kindly,

Garrett

I’ve been keeping up with my daily walks on the beach. It’s the best part of my day. What keeps you sane? Do more of it.

I’ve been keeping up with my daily walks on the beach. It’s the best part of my day. What keeps you sane? Do more of it.

Garrett John Law

I’m a Los Angeles-based real estate investor and software engineer.

https://garrettjohnlaw.com
Previous
Previous

Tech Elevator Week 4: “Show Your Work!”

Next
Next

Tech Elevator Week 2: “Creativity Requires The Courage To Let Go Of Certainty”