标签:des http java color strong os
This is the 1st pattern I study. In here, I will mark down my doubts, java study, DESIGN PRINCIPLES, DESIGN PATTERN.
There are 3 design principles in this pattern:
1. Identify the aspects of your application that vary and separate them from what stays the same (Codeproject)
2. Program to an interface, not an implementation (Stackoverflow)
3. Favor composition over inheritance (Stackoverflow)
Java study:
1. In C++, Absolute C++ said we need to encapsulate so that we separate codes into Interface (.hpp) and Implementation (.cpp). But in Java, just use:
public interface name{}
public class name{}
2. In strategy DP, encapsulate algorithms for one interface. and the duck base class needs to be inherited, and use abstract method. By defining an abstract method, the class needs to be defined as:
public abstract class Duck{}
3.
UML notations: (ref: codeproj link shown before)
HF-DP1: strategy pattern,布布扣,bubuko.com
标签:des http java color strong os
原文地址:http://www.cnblogs.com/gpuasic/p/3837809.html