WWDC 2015 Protocol Oriented Programming in Swift

김민종·2023년 3월 1일
0

WWDC

목록 보기
2/4

Before introducing protocol oriented progrmming, Dave introduces advantage of Class

  1. Encapsulation
  2. Access Control
  3. Abstraction
  4. NameSpace
  5. Name Space
  6. Expressive Syntax
  7. Extensibility

But Crusty(person who does not like Class)says it classes work can be replaced with struct and enum and saying 3 uncomfortable things of Class.

  1. Class shares data automatic, So from other sub class the change of super class could not be noticed and hard to know when the data has changed.
  2. Class inheritance is too intrusive
  • If stored property exists you must accept them
  1. It is not appropriate for type related program

At this example shows that class always need implementation
other is not defined so that it should be down casted and it it leading class to not Monolithic and Class can be massive in larger programming.

Reference : WWDC 2015 Protocol Oriented Programming

profile
신입 ios개발자입니다!

0개의 댓글