👌

DIP and Factory MEMO

1 min read
  • 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

ログインするとコメントできます