本月博客排行
-
第1名
arpenker -
第2名
kaizi1992 -
第3名
wy_19921005
年度博客排行
-
第1名
龙儿筝 -
第2名
宏天软件 -
第3名
青否云后端云 - wallimn
- vipbooks
- gashero
- wy_19921005
- benladeng5225
- fantaxy025025
- javashop
- e_e
- tanling8334
- arpenker
- sam123456gz
- kaizi1992
- zysnba
- xiangjie88
- lemonhandsome
- ganxueyun
- xyuma
- Xeden
- wangchen.ily
- zhanjia
- jh108020
- johnsmith9th
- zxq_2017
- jbosscn
- forestqqqq
- ajinn
- daizj
- xpenxpen
- wjianwei666
- ranbuijj
- 喧嚣求静
- kingwell.leng
- silverend
- lchb139128
- kristy_yy
- jveqi
- lich0079
- lzyfn123
- java-007
- sunj
- yeluowuhen
- lerf
- xiaoxinye
- flashsing123
- zhangjijun
- lxguy
- lyndon.lin
最新文章列表
DesignPattern : Factory
1. Why should we use Factory Method?
1) We want to control the way we create new instance of a certain class. We cannot merely use the new XXX() to create an instance.
2) We want to keep our ...
simple factory
package simpleFactory;
public class Girl
{
public String name;
public int age;
public Girl(){}
public Girl(String name,int age)
{
this.name = name;
this.age = age;
}
public String toString( ...
Design Pattern: Simple Factory 模式
文章来源:Gossip@caterpillar
Simple Factory模式(又称Static Factory模式),一个Simple Factory生产成品,而对客户端隐藏产品产生的细节。实作时定义一个产品介面(interface),并透过特定静态方法来建立成品。
假设有一个音乐盒工厂,购买音乐盒的客人不用知道音乐盒是如何制作的,他只要知道如何播放音乐盒就可以了,以 UML 类别图来 ...