Difference between Strategy pattern and Command pattern

后端 未结 6 1567
一整个雨季
一整个雨季 2021-01-29 21:22

What is the difference between the Strategy pattern and the Command pattern? I am also looking for some examples in Java.

6条回答
  •  误落风尘
    2021-01-29 21:44

    The main difference is , the command does some action over the object. It may change the state of an object.

    While Strategy decides how to process the object. It encapsulates some business logic.

提交回复
热议问题