lundi 22 avril 2019

Why State Design Pattern over If-else

Every where I find people saying it is better to use state design pattern over if else , I want to know how :

  1. It is an improvement to if-else in real world use case ?
  2. Does it make code more testable ?

can any one please provide an example where state pattern actually improves the case, it is difficult to make sense of why i shall take the overhead of following state pattern when i can use if-else.

Examples over the internet is not enough to show how this pattern solves the real world problem or makes code more maintainable.

Aucun commentaire:

Enregistrer un commentaire