👌

DIP and Factory MEMO

2020/10/03に公開
  • If codes dependent on volatile class codes can break
  • Abstract class is what doesn't change
  • Concrete class is what does change
  • Codes depending on abstract class doesn't break.

Example

  • String is concrete class but doesn't change. So Codes dependent of String have no proglems.
  • Every new sentence dependent on concrete class. We can seperate dependency from some code to factory.

Discussion