Learning a design pattern (strategy pattern)

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/AinUser/article/details/99982926

Refer to the following article: https://www.cnblogs.com/lewis0077/p/5133812.html

Strategy pattern personal experience:

1. Clear the code may be a plurality if else

2. each policy can replace each other algorithms

3. If the policy is changed, the new interface implementation class directly to the basic need major changes

4. good scalability and maintainability

Guess you like

Origin blog.csdn.net/AinUser/article/details/99982926
Recommended