TIL(OOP)

JEHYUN KIM
2 min readDec 9, 2020

OOP stands for Object-Oriented Programming(객체 지향 프로그래밍).
Originally, the computer was using Procedural Programming.
It’s about telling the computer what to do step by step. Procedural programming relies on procedures. However, as time goes by it wasn’t really easy for procedural programming to catch up with our big, developed projects.
There were problems with the high complexity and the cost.

So later on, the OOP was invented to solve the problems. OOP is more like giving tasks to the small parts(objects) to let them deal with it and then combine to solve a bigger problem.
We could metaphorize this to a desktop PC. Think like each ram, SSDs, keyboards …etc are objects. Once you have it you can reuse it anywhere and if you need to fix the keyboard all you have to do is fix the keyboard instead of building your desktop PC from scratch again. This way we can save time and money.

When viewed broadly(?) there are three components under the OOP.
1. Class : a blueprint(청사진) for creating objects. Defines properties and behaviours in the same group.
2. Object : Instance of a class. Has it’s own property.
3. Method : How to use an object that is made out of the class.
*청사진(blueprint): 아키텍처 또는 공학 설계를 문서화한 기술 도면을 인화로 복사하거나 복사한 도면. 은유적으로는 “어떠한 자세한 계획을 일컫는 데에 쓰인다.” — Wikipedia

Principles of OOP

Encapsulation(캡슐화)
The main feature of OOP. It’s like a protective barrier from a pill. Can stop objects from communicating with each other. Easy to reuse and since it’s separated from the rest of the code, less likely to occur an error.

Abstraction(추상화)
This is about simplifying. When we are using an Ipad we don’t really need to know every part of it like what happens inside if we take a screenshot using the buttons. Abstraction is about showing the most important things.

Inheritance(상속성)
The child class inherits the properties from the parent class. And we can add new properties and operations to the child class

Polymorphism(다형성)
This means that it can be expressed in different forms. When an object from a different class gets the same method, it works in its own way. Say you order a book. It could be a comic book or a novel and even something else.

I am still new to learning JS and everything so keep in mind a lot of info might not be accurate and it would be nice if I could get some advice.
Try to stay healthy and good luck to you all.

--

--