04 2012 档案

摘要:The Iterator Pattern provides a way to access the elements of an aggregate object sequentially withoutexposing its underlying representation 阅读全文
posted @ 2012-04-27 21:47 qiangzhu 阅读(489) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2012-04-27 21:19 qiangzhu 阅读(475) 评论(0) 推荐(0)
摘要: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. 阅读全文
posted @ 2012-04-26 15:15 qiangzhu 阅读(282) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2012-04-25 14:33 qiangzhu 阅读(446) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2012-04-25 11:33 qiangzhu 阅读(456) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2012-04-25 11:05 qiangzhu 阅读(366) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2012-04-24 20:09 qiangzhu 阅读(193) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2012-04-24 16:35 qiangzhu 阅读(436) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2012-04-24 16:01 qiangzhu 阅读(524) 评论(0) 推荐(0)
摘要: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. 阅读全文
posted @ 2012-04-18 17:52 qiangzhu 阅读(691) 评论(0) 推荐(0)