04 2012 档案
摘要:The Iterator Pattern provides a way to access the elements of an aggregate object sequentially withoutexposing its underlying representation
阅读全文
摘要:The Template Method Pattern defines the skeleton of algorithm in a method, define some steps tosubclasses. Template Method lets subclass redefine certain steps of an algorithm without changingthe algorithm's structrue.Class diagram:abstract class AbstractClass{ final void templateMethod(){ primi
阅读全文
摘要:1.FindBugs -http://findbugs.cs.umd.edu/eclipse/eclipse plugin installation -http://findbugs.cs.umd.edu/eclipse2.PMD -http://pmd.sourceforge.net/eclipse/eclipse plugininstallation -http://pmd.sourceforge.net/eclipse3.CheckStyle -eclipse plugin installation -http://sevntu-checkstyle.github.com/sevntu.
阅读全文
摘要:Design Principle(Open-Closed Principle)Classes should be open for extension, but closed for modification.The Decorator Pattern attaches additional responsibilitis to an object dynamically.Decorator provide a flexible alternative to subclassing for extending functionality.public abstract class Bevera
阅读全文
摘要:The Observer Pattern defines a one-to-many dependency between objects so that when oneobject changes state, all of its dependents are notified and updated automatically.The Observer Pattern defines a one-to-many relatioship between objects.Design PrincipleStrive for loosely coupled designs between o
阅读全文
摘要:Design Principle:Identify the aspects of your application that vary and sparate them from what stays the same.Program to an interface, not an implementation.Favor composition over inheritanceThe Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable.St
阅读全文
摘要:1.String,StringBuffer和StringBuilder区别String为immutable,StringBuffer为线程安全,StringBuilder非线程安全2.如何对一已知的List中的对象排序Collections.sort<List<T> list, Comparator<? super T> c>对象实现Comparator接口的compare(T o1, T o2)方法3.Java API中Arrays.sort(int[] a)排序算法是如何实现的if(len < 7){ //Insertion sort on sma
阅读全文
摘要:The Facade Pattern provides a unified interface to a set of interfaces in a subsystem. Facade defines a higher-levelinterface that makes the subsystem easier to use.A facade not only simplifies an interface, it decouples a client from a subsystem of components.Facades and adapters may wrap multiple
阅读全文
摘要:The Adapter Pattern converts the interface of a class into another interface the clients expect.Adapter lets classedwork togetherthat couldn't otherwise because of imcompatible interfaces.Object and class adaptersclass diagramThe only difference is that with class adapter we subclass the Target
阅读全文
摘要:Command Pattern allows you to decouple the requester of an action from the object actually performs the action. A commandobject encapsulates a request to do something on a specific object.From dinner to the Command Pattern1.Implementing the Command interfacepublic interface Command{ public void exe.
阅读全文