Post #90: The Pillars Of Object-oriented Programming: Object, Class, Inheritance, Polymorphism, Abstraction

Post #90: The pillars of object-oriented programming: Object, Class, Inheritance, Polymorphism, Abstraction and Encapsulation, 2023.

The concept of object oriented programming explained

Object-oriented programming is a fundamental concept present in numerous programming languages such as C++, Java, JavaScript, and more. It becomes straightforward once you truly grasp it, and that's precisely what this post aims to help you achieve. So, stop your scrolling for a second and delve into this post for a thorough and clear explanation.

The Concept Of Object Oriented Programming Explained

Understanding the Term "Object-Oriented"

To grasp OOP, let's begin by explaining the name itself: "Object-Oriented." This term signifies that OOP revolves around entities known as "objects."

What Exactly Is an Object?

An object in OOP is any entity that possesses both state and behavior. Consider a dog as an example: it has states such as color, name, and breed, while its behaviors encompass actions like wagging the tail, barking, and eating.

The reason we introduce the concept of objects in programming is to effectively represent real-world entities, a task that cannot be accomplished with conventional variables or arrays.

Classes: Abstract Forms of Objects

Now, what about classes? A class is essentially the abstract form of an object. If we take the example of a "dog," the object "Mydog" is a concrete instance, while the class "dog" represents dogs in a more general sense. Think of a class as a blueprint or template from which you can create individual objects.

Four Pillars of Object-Oriented Programming

Now that we've established the fundamentals of objects and classes. OOP is built upon four key principles:

Inheritance: Inheritance occurs when one object inherits all the properties and behaviors of a parent object. It promotes code reusability and facilitates runtime polymorphism.

Polymorphism: Polymorphism entails performing a single task in multiple ways. For instance, it can involve presenting information differently to customers or implementing different shapes like triangles or rectangles.

Abstraction: Abstraction is about concealing internal details while exposing functionality. Consider a phone call; we don't need to understand the intricate inner workings.

Encapsulation: Encapsulation involves bundling code and data into a single unit. Just like a capsule contains various medicines . In a fully encapsulated class (e.g., a Java bean), all data members are private, ensuring data integrity and controlled access.

I remember finding these images that explained these concepts using the 'Squid Game' series, and they are just perfect. So, I'm sharing them here and giving all credit to their owner :

Polymorphism , Inheritance , Encapsulation

More Posts from Python-programming-language and Others

W3Schools - Learn To Code ...

W3Schools - Learn To Code ...

For example: Python ...

W3Schools - Learn To Code ...

Post #114: W3Schools, Learn To Code - With The World's Largest Web Developer Site, 2024.


Tags

Python Tips And Tricks ...

Python Tips: 10 Tricks for Optimizing Your Code - Stackify
Stackify
Python is widely used in various industries, and we've got 10 tricks and more to help write cleaner, faster and more maintainable code

Post #134: Stackify, Prit Doshi, Python Tips, 10 tricks for optimizing your code, June 2024.


Tags

Python - Turtle Programming, Mandala ...

Python - Turtle Programming, Mandala ...

The output of my source code ...

Python - Turtle Programming, Mandala ...

The source code of my exercise ...

Python - Turtle Programming, Mandala ...

The development of the Mandala on the screen ...

Post #22: Python - Turtle Programming, Mandala, Idea: Claudia Ermel & Olga Runge, Erste Schritte mit Python für Dummies 'Junior', Wiley Verlag, Weinheim, 1. Auflage, 2017.


Tags

Programmieren lernen mit Michael Kofler ...

Obwohl die Entwicklung von Python schon 1991 begann, stand die Sprache lange im Schatten anderer Programmiersprachen. So richtig im Mainstream angekommen ist Python erst in den vergangenen Jahren. Dabei gibt es viele Gründe für die Popularität von Python: 1. recht einfache Syntax, 2. gut lesbarer Quelltext, 3. schlanke Programmiersprache, 4. effektives Modulkonzept, 5. eignet sich für Wissenschaft, Forschung und Bildung und 6. bevorzugte Programmiersprache beim Raspberry Pi.

Programmieren Lernen Mit Michael Kofler ...

Although development of Python began in 1991, the language has long been overshadowed by other programming languages. Python has only really arrived in the mainstream in recent years. There are many reasons for the popularity of Python: 1. very simple syntax, 2. easily readable source code, 3. lean programming language, 4. effective module concept, 5. suitable for science, research and education and 6. preferred programming language for the Raspberry Pi.

Post #47: Michael Kofler, Python - Der Grundkurs, Rheinwerk Verlag, Bonn, 2. aktualisierte Auflage, 2022.


Tags

Python Tutorial, #13 While-Schleife ...

Python Tutorial, #13 While-Schleife ...

The source code and output of my exercise ...

Python Tutorial, #13 While-Schleife ...

Post #49: YouTube, Programmieren-Starten, Python Tutorial, #13 While-Schleife, 2023.


Tags

Object-Oriented Programming in Python ...

Object-Oriented Programming in Python – Explained in Plain English
freeCodeCamp.org
> “Any fool can know. The point is to understand.” - Albert Einstein Object-oriented programming is a popular way to write computer programs

Post #80: FreeCodeCamp, Object-Oriented Programming in Python, Explained in plain English, 2023.


Tags

Python Tutorial - Zero to Hero ...

I recommend this excellent Python Tutorial !!!

Post #131: YouTube, TechWorld with Nana, Python Tutorial for Beginners, Learn Python in 5 hours, 2024.


Tags

Catch my number with a random number ...

The source code of my exercise ...

Catch My Number With A Random Number ...

The output of my source code ...

Catch My Number With A Random Number ...

I came up with this little exercise in which a six-digit number entered by the computer has to be matched exactly with a generated random number. You can imagine that with the many attempts, the million mark is quickly exceeded.

The source code of my exercise ...

Catch My Number With A Random Number ...

On this occasion I also tried the "Colorama" module for Python, which allows you to set the foreground and background color in the console.

Post #42: Exercise - Catch My Number With A Random Number, 2023.


Tags

Python Tutorial #20 Funktionen mit Rückgabewert ...

The source code of my exercise ...

Python Tutorial #20 Funktionen Mit Rückgabewert ...
Python Tutorial #20 Funktionen Mit Rückgabewert ...

The output of my source code ...

Python Tutorial #20 Funktionen Mit Rückgabewert ...

Post #77: YouTube, Programmieren-Starten, Python Tutorial, #20 Funktionen mit Rückgabewert, 2023.


Tags
Loading...
End of content
No more pages to load
  • echo-fromafar
    echo-fromafar reblogged this · 1 month ago
  • apric-t
    apric-t liked this · 1 month ago
  • skruzdelynas
    skruzdelynas liked this · 5 months ago
  • nezulize
    nezulize liked this · 7 months ago
  • derpy-greetings
    derpy-greetings liked this · 10 months ago
  • mhizah
    mhizah reblogged this · 1 year ago
  • mhizah
    mhizah liked this · 1 year ago
  • letscandyme
    letscandyme liked this · 1 year ago
  • stargirll111
    stargirll111 liked this · 1 year ago
  • cloudsarerad
    cloudsarerad liked this · 1 year ago
  • binarykinto
    binarykinto liked this · 1 year ago
  • turtle-programming
    turtle-programming liked this · 1 year ago
  • hisonakii
    hisonakii liked this · 1 year ago
  • python-programming-language
    python-programming-language reblogged this · 1 year ago
  • basic-retro-programming
    basic-retro-programming liked this · 1 year ago
  • codinquill-personal
    codinquill-personal reblogged this · 1 year ago
  • m0thmancore
    m0thmancore liked this · 1 year ago
  • python-programming-language
    python-programming-language reblogged this · 1 year ago
  • python-programming-language
    python-programming-language liked this · 1 year ago
  • monsters-smoocher
    monsters-smoocher liked this · 1 year ago
  • mmhysa-b
    mmhysa-b liked this · 1 year ago
  • hanifahstory
    hanifahstory liked this · 1 year ago
  • elu-xx
    elu-xx reblogged this · 1 year ago
  • granddyke
    granddyke liked this · 1 year ago
  • zoeythebee
    zoeythebee liked this · 1 year ago
  • vexacarnivorous
    vexacarnivorous reblogged this · 1 year ago
  • risicodes
    risicodes liked this · 1 year ago
  • starrystudiesworld
    starrystudiesworld reblogged this · 1 year ago
  • asterisquue
    asterisquue liked this · 1 year ago
  • therewillbebetterdays1717
    therewillbebetterdays1717 reblogged this · 1 year ago
  • nerdmars
    nerdmars liked this · 1 year ago
  • landofpeacelovejusticeandnomercy
    landofpeacelovejusticeandnomercy reblogged this · 1 year ago
  • feyrce
    feyrce liked this · 1 year ago
  • whatialreadyhaveablog
    whatialreadyhaveablog liked this · 1 year ago
  • xiabablog
    xiabablog liked this · 1 year ago
  • codingquill
    codingquill reblogged this · 1 year ago
python-programming-language - Python Programming
Python Programming

Fan, Exploration & Learning Page

173 posts

Explore Tumblr Blog
Search Through Tumblr Tags