OOP vs POP

#pop #protocolorientedprogramming #oop #objectorientedprogramming

Overview

The main difference between OOP & POP is inheritance.

POP focuses on what an object can do, while OOP focuses on what an object is (Rebeloper).

Value Type: struct, enum

Reference Type: Class

Object-Oriented Programming

Properties

  • Inheritance from one SuperClass.

  • It focuses on what an object is (Rebeloper).

Protocol-Oriented Programming

Properties

  • Inheritance from other Protocols and even from multiple Protocols.

  • Allows smaller and specıfıc protocols.

  • It focuses on what an object can do (Rebeloper).

  • They have suffixes like "-able"

Advantages

  • Code clarity

  • Reusability

  • Separation of classes

Protocol Extensions

Things to consider

  • Too granular protocols will be hard to manage.

Protocol vs Class vs Struct

Structs are unique copies. They copy the data over and over again

Sources

Videos

Articles / Documents

Last updated