Beginner’s Introduction to Object-Oriented Programming (OOP).

Object Oriented Programming is a popular programming paradigm for displaying real-world objects programmatically.

Mohana S
4 min readNov 8, 2022

(This article is mainly for those with no prior knowledge of OOPs and also try using the Text to speech option to listen to this article)

object oriented programming for beginners by hyperxd

Contents:

  1. What is Programming?
  2. Different types of Programming paradigms?
  3. Procedural Programming Paradigm.
  4. Functional Programming Paradigm.
  5. Object Oriented Programming Paradigm.
  6. What are Class and Object?

What is Programming?

Before learning oops we should know what is programming.

  • Computers don’t know what is there in your mind also they don’t understand plain English, it needs everything in 0’s and 1s.
  • As a programmer, we find it very difficult to give instructions using only 0’s and 1’s. Therefore, I need something that I can write in plain English and then convert to 0s and 1s.
  • Here come programming languages, but there are different approaches to writing the program most used one is oops.

Different types of Programming paradigms?

Everywhere you hear about oops, you may think that oops is one way to write programs, if not then what are the other ways?

Different types of Programming paradigms are Imperative and Declarative
  • I hope you have started to learn the programming language it could be c, c++ java, or python it doesn’t matter.
  • I learned c as my first programming language. some people choose python.
  • Irrespective of the programming language our main intention is to give some instruction to the computer, these languages are a kind of translator that just convert what you have written into what the computer can understand. as I said earlier computers only understand 0 and 1.
  • You can consider it a google translator.
  • Also, you can’t just write what comes to your mind. there are some rules there is a way that we call programming paradigms/patterns.
  • There are two types one is Imperative and the other is Declarative.
  • In Imperative programming, we define step-by-step instructions to get the result.
  • In Declarative programming, we explicitly won’t define how we should get results. we give input we get some results.

An example of Imperative and Declarative programming is imperative programming is like preparing coffee using milk sugar and coffee powder but, in declarative programming using a coffee machine.

Procedural Programming Paradigm.

procedural programming is writing step-by-step instructions and using statements loops even functions but they are not pure.

Examples: C, C++, Java, Pascal.

Functional Programming Paradigm.

functional programming using only functions (pure functions = for same input same output), helps us to write repetitive codes which maintain only local state, it uses recursion for looping. many languages support this paradigm.

Examples: Perl, JS, Python, etc.

Object Oriented Programming Paradigm.

The most popular one is oops which represents real-world objects such as humans animals vehicles etc. it also contains procedures and functions but oops utilizes them in a much better way.

Examples: C++, Java, Python

Human Object in Object oriented Progeamming

for example, there is an object called a human. humans have eyes hands legs, ears, etc. these are properties of humans then humans can walk, dance, and, run these are functions. this is it.

this is what we have to represent programmatically. this depends on which programming language you use. Also, that should support oops.

let’s understand oops by creating one object car (pseudo code)

Car Object and its Class in oops
  • above example building a car class ( represents objects ) is one time process using this we can build different types of car objects.
  • you might have seen car companies building different models but they all share similar properties. for example, consider TATA motors they use the same car with different fuel options like diesel and EV.

What are Class and Object?

  • class is nothing but just a blueprint or we can say it is just a sketch, it tells how the object should look and behave.
  • class doesn’t have any physical memory allocated in the program.
  • but is on another hand object it is built using class. we can have n number of objects with dedicated physical memory for a particular class, each we call instances because each contains different information at different times.
Car class and its instances in object oriented programming

In the above example BMW, Audi, and Toyota are the instance of object cars that were created with help of car class.

For More Information Watch the below oops youtube video.

--

--

Mohana S

Creating content for fun 🎉. Keep up with the fun by following me and subscribing to my email list. Youtube: https://youtube.com/@HyperXD_YT