Object Oriented Programming

object oriented programming concepts

Principles of OOP

Object Oriented Programming is a vast subject and it’s driven by principles mentioned below.

  1. Abstraction
  2. Encapsulation
  3. Inheritance
  4. Polymorphism
  5. Composition
    - Association
    - Aggregation

Real-world models of OOP

  1. Abstract class
  2. Interface

Note: Examples of this and its related articles are related to high level statically typed object oriented languages such as C# and Java.

Short summary OOP principles

  1. Abstraction
    - To ‘abstract’ something away means to hide away the implementation details.
  2. Encapsulation
    - The definition of encapsulation is “the action of enclosing something in or as if in a capsule”. Removing access to parts of your code and making things private is exactly what Encapsulation is all about (often times, people refer to it as data hiding).
  3. Inheritance
    - Inheritance lets one object acquire the properties and methods of another object.
  4. Polymorphism
    - The word polymorphism means having many forms. Polymorphism is a very generic term, which basically just means “the ability of dealing with different types”.
  5. Association
    - Association is a relation between two separate classes established through their objects. This allows you to model a ‘has-a’ association between objects. Composition and Aggregation are the two forms of association.
    1) Composition
    - Composition is a restricted form of Aggregation in which two entities (or you can say classes) are highly dependent on each other, for e.g. a human and a heart.
    2) Aggregation
    - In this relationship an object can survive even if other one ends. For example if Wallet class is not present, it does not mean that the Money class cannot exist.

In-depth guides:

Now that we have a short version of these properties, we can now dive deep into each property because you will find their implementations complement each other.

Click on the links for simple and yet in-depth guide to each topic:

Thank you for reading this article. I hope this and its related articles will help you start your programming journey.

References:

Disclaimer & fair use statement:

This website may contain copyrighted material, the use of which may not have been specifically authorized by the copyright owner. This material is available in an effort to explain concept of Object Oriented Programming designs in an articulate and summarized manner to be used as an educational tool. The material contained in this website is distributed without profit for research and educational purposes. Only small portions of the original work are being used and those could not be used easily to duplicate the original work. This should constitute a ‘fair use’ of any such copyrighted material (referenced and provided for in section 107 of the US Copyright Law). If you wish to use any copyrighted material from this site for purposes of your own that go beyond ‘fair use’, you must obtain expressed permission from the copyright owner.

--

--

--

Solution developer, Workaholic

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Cross platform input controller | Unity

Automating water bill generation for an apartment society

Weekly Report #4 — Motivation

Google Developer Group Chennai & ITM HackFest ’18

Connecting Unity with a database using Python Flask REST WebService

Midway Serverless — A Node.js framework for Serverless — Interview with Harry Chen

My developer journal: Sprint V — Finishing up

Using Kotlin from CLI on Mac

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
AKshay Raut

AKshay Raut

Solution developer, Workaholic

More from Medium

Encapsulation in Object Oriented Programming

Object Oriented Programming

Method Overriding and Method Overloading

Redirect www to non-www with Azure serverless function (Linux server)