What is Object Oriented Programing?

Object Orientation is the most widely used programming paradigm there is, every major programming languange uses object oriented programming principles and that includes Java, Python, C++, C#, PHP, Swift etc and it includes Kotlin.

Objected Oriented Programing (OOP) dates back to the 1980's

OOP is a natural way to model a software and probably one of the many reasons it has been adopted so widely. What we really do is model the real world and program it in code, and we can do that by giving them properties and capabilities.

We model our objects using classes and from classes we can create unlimited instantiation of objects.

OOP is a way of programming that involves breaking our requirements down into chunks that are more manageable than the whole.

OOP allows you to write apps for highly complex situations without breaking a sweat. You can create multiple similar yet different versions of a class without st arting the class from scratch using inheritance.

For example we may what to model an object such as Car and a Human in our App.



Properties of the Car may Include
  1. Manufacturer
  2. Color
  3. Type of Engine etc
Capabilities of the Car may include
  1. the ability to Accelerate, decelerate or halt
  2. the possibility to fly (flying car? :) lol )
Properties of Human
  1. Name
  2. Sex (male or female)
Capabilities of a Human
  1. ability to drive
  2. ability to play musical instruments
Once we have modeled these (a Human and a Car) we can model the relationship between each of our object, for example a Human may actually own a car, so that becomes our model of abstraction of the real world.

Summary:

Comments

Popular posts from this blog

How to select Multiple Item in RecyclerView in Android

Android Clipboard Listener - How to Know when User copies a text in Android

Kotlin: Array vs List - Similarities and Differences