Sitemap
İclal Şeyma Koca

İclal Şeyma Koca

Mechanical Engineer

Object-Oriented Programming (OOP) Python

2 min readNov 18, 2022

--

Hello, I am Şeyma, one of the participants of the SistersLab Women in Tech Academy project supported by Toplum Gonulluleri Vakfı (https://www.tog.org.tr/en/).

The project aims to empower people between the age of 20–28 who identify as women, through 3 months long software training and supporting training to increase their participation in the workforce in the IT sector.

You can access detailed information about the project using this link: https://sisterslab.co/women-in-tech-academy/

I will share with you what I learned about python as part of this beautiful project. I wish you good reading.

In this story, I will talk about object-oriented programming, that is, OOP. I wish you good reading.

First, let’s answer the question of why object-oriented programming.

Advantages of Object-Oriented Programming. It is quick and easy to implement the approach. It provides a clear structure for programs. It implements the Do Not Duplicate principle and makes the code easier to maintain, edit, and debug. It makes it possible to build reusable applications with less code and shorter development time. It provides extensibility by adding new features to the structure later on. Models problems according to real-life processes.

Class Definition

Patterns to be used to define a class class class name () : body

Get İclal Şeyma Koca’s stories in your inbox

Join Medium for free to get updates from this writer.

and class can be said as class name : body.

Creating a Class with Default Values

It is created by putting “:” after typing the name you want to give next to my class keyword. If you want, you can list by pressing enter. Like creating a dictionary, you can successfully create it with the words you type in “ “ together with the noun equals. We use the __init__ function and the self keyword to create instance attributes. The __init__ function is the first to run when we create an object from a class. We use the self keyword as the first parameter of this function. In order to get output from the instance attributes, we must produce an object from our class, that is, instantiate our class.

OOP Operations:

  • Encapsulation

is an access blocking

  • Inheritance

can be described as participation or inheritance.

  • Abstract Class

It is a general definition for abstract classes.

  • Overriding

Overwrite operation.

  • Polymorphism

it shouldn’t actually be considered as a transaction, but OOP transactions are very complex, this is what it was meant to be mentioned in this article.

You have reached the end of this story. I hope it was informative for you, see you in the next story.

Press enter or click to view image in full size

--

--