Object Orientation is the most widely used programming paradigm there is, every major programming language uses object-oriented programming principles and that includes Java, Python, C++, C#, PHP, Swift etc and it includes Kotlin.
Objected Oriented Programming (OOP) dates back to the 1980s
OOP is a natural way to model 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 an 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 starting 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
- Type of Engine etc
Capabilities of the Car may include
- the ability to Accelerate, decelerate or halt
- the possibility to fly (flying car? 🙂 lol )
Properties of Human
- Sex (male or female)
Capabilities of a Human
- ability to drive
- 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.
- Properties of a class define data inside our class
- Capabilities define the functionality that our class provides
- Properties (data) and capabilities (functions) define the two major things we need in a class
[box type=”shadow” align=”” class=”” width=””]
Further Reading :