"Design pattern" Java Design pattern the 0th lesson of the Strategy mode

Source: Internet
Author: User

From today on <, intends to write a note every chapter of the study, today's 0th article hope is a good beginning, can finish. Come on.


Getting Started with design patterns: Strategy mode (see what the actual requirements (scenarios) are, and adopt the appropriate strategy)


    • Design principle 0: No matter how good the software design, after a period of time always grow and change, otherwise the software will die.

    • Design principle One: Find out where changes in your application might be needed, separate them, and don't mix with code that doesn't need to change
      • Take the changing parts out and wrap them so that the rest of the parts won't be affected.
      • This leads to fewer unintended consequences, and the system becomes more resilient.

    • Design principle two: Programming for interfaces, not for reality
      • Using interfaces with each behavior of the table and then implementing these interfaces by the behavior class

    • Design principle Three: Multi-use combination, less with inheritance.
      • Using the combination to build the system has great elasticity, not only can the behavior of the class be divided into classes, but also can be re-run dynamic change behavior


Chapter One Introduction to the design pattern using a duck example introduces the strategy mode. (The implementation of the strategy mode depends mainly on Java runtime polymorphism), explaining the importance of a good class hierarchy design in OO programming language, before we design a system, we should fully consider the future scalability of the system and the reusability of code.


The code in the book should personally knock on the machine to run again, seriously understand the design ideas.


Friends who do not want to personally tap the code can refer to my resources.


http://download.csdn.net/detail/lchad/8441187


"Design pattern" Java Design pattern the 0th lesson of the Strategy mode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.