Join our Full-Stack Web Development Bootcamp and become a software engineer in 3 months

What is Object Oriented Programming (OOP)?

Object Oriented Programming (OOP) is a key concept you should know when you learn to code. Learn more about it here.

Home - Coding - What is Object Oriented Programming (OOP)?

teamwork

Object Oriented Programming (OOP) is the foundation of mastering most of the widely used programming languages such as Java, Python, Ruby and, of course, Swift. It helps you in the process of designing your app because an app without any proper planning will make you go crazy (trust me, been there, done that).

OOP may sound rather abstract but it’s very relatable to your everyday life. To illustrate how this logic works, let’s talk about building your own e-commerce app like Lazada. Before you build it, think about what your app is, in a very simple manner, preferably a one-liner.

Lazada is a marketplace where buyers purchase goods from sellers.

Yes, keep the idea as simple as possible. Once you have got it, check out the 4 step-by-step guide below that will give you an overview of how Object Oriented Programming (OOP) works.

Image result for object oriented programming

Step 1: Understand the term β€˜Object’ in OOP.

What is β€˜Object’?

An object is a noun that refers to things, person and place (I hope this rings a bell). For example, a car is an object.

Once you have figured out what object means, let’s move on to step 2.

Step 2: Identify the objects in the description

Single out all the objects you can find in your description of your app.

Lazada is a marketplace where buyers purchase goods from sellers.

So far so good? That was easy right?

Image result for coding

Step 3: Extract the objects out and singularize them

So now we have:

  1. Marketplace
  2. Buyer
  3. Goods/Product
  4. Seller

In this example, the noun β€˜marketplace’ is too generic as it refers to the main idea of the app itself, therefore, it will be excluded. It will also be great to think outside the box (since you want to be a programmer) and imagine what else the app allows buyers and sellers to do. When you use Lazada, I am sure you would always go through the reviews of the products before deciding whether to buy them. There you go, now we have 1 more object identified:-    

  1. Buyer
  2. Goods/Product
  3. Seller
  4. Review

Step 4: Think about the properties and functions of the object

After coming up with a list of objects that you think are essential to your app, you should then ask yourself 2 questions about the object:

  1. What does the object have? (properties)
  2. What can the object do? (functions)

‍

Let’s look at the following examples:

Both buyer and seller have name, birth date, email address and other personal information about themselves.

Buyer can browse through different products, add them to cart and purchase them. Seller can upload their own products and accept payment from buyer.

Why is this important?

Without knowing properties of the object, you would not be able to have a clear idea of what information your app should store and display. Without knowing functions of the object, you would not be able to write the logic which powers the way your app works.

Let’s look at another example to make sure you understand this concept:

Product has brand name, description, price, quantity available.

Product can be purchased by a buyer (lowering the quantity available).

Congratulations! If you are able to follow these 4 steps, you have understood the most fundamental part of the concept – OOP.But wait, are you sure you really get it?

Challenge for you!

How can you apply the concept of OOP to popular apps such as Uber and Airbnb using the guide above?Let us know by commenting below.

Website | + posts

Share:

Facebook
LinkedIn
Twitter
WhatsApp
Email
Also on The NEXT Blog

Ready to learn?

Great for you if you want to learn specific stuff but not necessarily to get a job.

Free Resources

Digital Marketing Course Preview

Skill Courses | Remote

2-in-1 Paid Advertising: Google, Youtube, Facebook Instagram Ads

Mini Marketing Courses Pre-Launch Offer

Great for you if you want to give coding a try. Also great if you are learning to code for specific stuff but not necessarily to get a job.

Topic Specific Courses

3-Day HTML, CSS & Bootstrap Online Course | Level 0

Code Your Algo Trading Bot with Python

Free Resources

Programming 101