What is the difference between the bridge pattern and the strategy pattern?

后端 未结 14 2173
予麋鹿
予麋鹿 2020-11-30 20:37

I tried to read many articles on dofactory, wikipedia and many sites. I have no idea on differences between bridge pattern and the strategy pattern.

I know both of t

14条回答
  •  感动是毒
    2020-11-30 21:01

    I think there's a slight difference between them in the context they're being used.

    I use the Bridge pattern to separate orthogonal concepts which they both belong to a bigger one - to let them vary independently. It usually involves multiple abstractions.

    IMO, the Strategy pattern is simpler or more flat. It serves to OCP for sure but doesn't necessarily to be part of another and bigger concept like the Bridge pattern.

提交回复
热议问题