《JAVA与模式》之简单工厂与工厂方法
一、简单工厂
1.1 使用场景
1、工厂类负责创建的对象比较少;
2、客户只知道传入工厂类的参数,对于如何创建对象(逻辑)不关心;
3、由于简单工厂很容易违反高内聚责任分配原则,因此一般只在很简单的情况下应用。
1.2 优缺点
优点:
工厂类是整个模式的关键.包含了必要的逻辑判断,根据外界给定的信息,决定究竟应该创建哪个具体类的对象.通过使用工厂类,外界可以从直接创建具体产品对象的尴尬局面摆脱出来,仅仅需要负责“消费”对象就可以了。而不必管这些对象究竟如何创建及如何组织的.明确了各自的职责和权利,有利于整个软件体系结构的优化。
缺点:
由于工厂类集中了所有实例的创建逻辑,违反了高内聚责任分配原则,将全部创建逻辑集中到了一个工厂类中;它所能创建的类只能是事先考虑到的,如果需要添加新的类,则就需要改变工厂类了。
当系统中的具体产品类不断增多时候,可能会出现要求工厂类根据不同条件创建不同实例的需求.这种对条件的判断和对具体产品类型的判断交错在一起,很难避免模块功能的蔓延,对系统的维护和扩展非常不利;
这些缺点在工厂方法模式中得到了一定的克服。
1.3 结构与角色
a、简单工厂模式类图:
该模式中包含的角色及其职责:
1、工厂(Creator)角色
简单工厂模式的核心,它负责实现创建所有实例的内部逻辑。工厂类可以被外界直接调用,创建所需的产品对象。
2、抽象产品(Product)角色
简单工厂模式所创建的所有对象的父类,它负责描述所有实例所共有的公共接口。
3、具体产品(Concrete Product)角色
是简单工厂模式的创建目标,所有创建的对象都是充当这个角色的某个具体类的实例。
具体代码:
//抽象产品角色
interface Board{ public void createBoard();
}
//具体产品角色
class GigabyteBoard implements Board{ public void createBoard() {
// TODO Auto-generated method stub
System.out.println("生产-->技嘉主板");
}
}
//具体产品角色
class AsusBoard implements Board{ public void createBoard() {
// TODO Auto-generated method stub
System.out.println("生产-->华硕主板");
}
}
//工厂角色
class SimpleFactory {
public static Board factory(String type){ if(type.equalsIgnoreCase("gigabyte")){ return new GigabyteBoard();
}else if(type.equalsIgnoreCase("asus")){ return new AsusBoard();
}
return null;
}
}
调用代码:
//简单工厂 一个静态方法 自身负责创建产品
Board board=SimpleFactory.factory("asus");
board.createBoard();
二、工厂方法
2.1 定义
工厂方法模式的用意是定义一个创建产品的工厂接口,将实际创建工作推迟到子类中。
其实工厂方法模式是简单工厂的一种延伸,在简单工厂模式中,一个工厂类处于对产品类实例化的中心位置上,他操纵所有下面的产
品类的实例化,当每次新加一个产品类的时候都要在工厂类里面进行修改。工厂方法模式就是解决这个缺点而来的,工厂方法模式把
创建每个产品实例化的工作交给了子类去做。成为一个抽象工厂,仅负责给具体工厂子类必须实现的接口,而不接触具体实例化的细
节。这样的核心工厂类就成为了一个抽象工厂角色,这样进一步的抽象化的好处是使得工厂方法模式可以使系统在不修改具体工厂角
色的情况下引进新的产品。
2.2 结构与角色
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABCEAAAF8CAIAAAB+ODYnAAAgAElEQVR4nO3dL4zcSJ//cT/kpxw4aWF05ALOUnQocIGlZ2BgzBZGMll2kc7SM9KCQb7AIZYi7YEAgyw5rawHRIsMQywFRkbDPHCAwUD/wFdTqin/aY/bf6o87xeIJt3tbrddZdenquz2WgAAAABYjrf3CgAAAAA4FDIGAAAAgCWRMQAAAAAsiYwBAAAAYElkDAAAAABLImMAAAAAWBIZAwAAAMCSyBgAAAAAlkTGAAAAALAkMgYAAACAJZExAAAAACyJjAEAAABgSWQMAAAAAEsiYwAAAABYEhkDAAAAwJLIGAAAAACWRMYAAKBt2/bm5qYAXHBzc7N3dQFOIGNMwokHE3HcBxz148cPD3DH169f9640wBgyxmmcePAkHPcBFxVF4Xneu3fvrgC7vX//3vO8z58/711pgDFkjNM48WAijvuAu+RQT/2F/SircAIZ4zQqMyaiqADuov7CFZRVOIGMcRqVGRNRVAB3UX/hCsoqnEDGOI3KjIkoKoC7DlB/y7JMkqT3qTiO67rWHwnDMMuyTdarX5ZleZ6nabrGm0dR1Pt4nuf7futFHKCs4jkgY5xmSWUuy7L38TzPJ77yAEa+Wnc7bM+SogJgBtfrb1mWcR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Lo+BNsjY0wxMWMMlfy2bfM8z7LM9319KK87jiFDDXLFhfHmasF5GaMduK9UmqbcV2pVZAwAgL16z1L6xG4RhqHedWpM1ZDXqyu5hREJVFPGmFxuDDWMX3ShnuquYbeVw21t9kXGmKK7lbojckb7vigKlQqappGn0jTVJywZi4RhKJVOv867fbhnw9BSOr2edpND7w3cGMRYGxkDAGCviQ1BaYvkeS63qVFNfJkLri7m9n1fPSVzxOUpucGUeje5bVT7ePzBuHlUdx3yPJd71PZ2jnZ/V5gfx9gXGWOKiVtJrncqyzLPc1XO5XIjqXEyHqiqhty5QWqZET/Uz1bUdW3cV0rdPMqYCdk+JHa5v21v9QzDUF+KH8fYABkDAGCvJzUE5c6V+pQMeUTaFuUDeUpGJOT2/NN/H8N4k+5SI5NGpHkkf+d5ThNnX2SMKaZvJSn8epUxfpFGrzgyItGtZWLo9zGUbsZoH+40NfTT3Xpi0f/GesgYAAB7rdcQHJn1tJ44jpumkd8N2PijYSBjTLHSVhq/fGIl6ia21L5tkDEAAPZar4mjz5XCM0TGmGKNrZTneRiGahoVjoqMAQCwFw1BrISiNQVbCbORMQAA9qKJg5VQtKZgK2E2MgYAwF40cbASitYUbCXMRsYAANiLJg5WQtGagq2E2cgYAAB70cTBSihaU7CVMBsZAwBgL5o4WAlFawq2EmYjYwAA7CVnqcvLywJY1PX1Na3nkwoqIOYaqWJkDADAzr59++YBq/ny5cveZdxqVECcqbeKkTEAAPv79OnTFbCC6+vr+/v7vQu47aiAmG2oipExAAAAACyJjAEAAABgSWQMAAAAAEsiYwAAAABYEhkDAAAAwJLIGAAAAACWRMYAAAAAsCQyBgAAAIAlkTEAAAAALImMAQAAAGBJZAwAAAAASyJjAAAAAFgSGQMAAADAksgYAAAAAJZExgAAAACwpP8PLkX63JZAbc0AAAAASUVORK5CYII=" alt="" width="922" height="355" />
抽象工厂角色(Creator)
工厂方法模式的核心,任何工厂类都必须实现这个接口。
。具体工厂角色(Concrete Creato)
具体工厂类是抽象工厂的一个实现,负责实例化产品对象。
。抽象角色(product)
工厂方法模式所创建的所有对象的父类,它负责描述所有实例所共有的公共接口。
。具体产品角色
工厂方法模式所创建的具体实例对象。
具体代码:
//抽象工厂
interface ComputerFactory{
public Computer createComputer();
}
//具体工厂
class SamsungComputerFactory implements ComputerFactory{ public Computer createComputer() {
return new SamsungComputer();
}
}
class HpComputerFactory implements ComputerFactory{ public Computer createComputer() {
return new HpComputer();
}
} //抽象产品
interface Computer{ public double price(); public double weight();
}
//具体产品
class SamsungComputer implements Computer{ public double price() {
// TODO Auto-generated method stub
return 8000;
}
public double weight() {
// TODO Auto-generated method stub
return 5.2;
}
}
class HpComputer implements Computer{ public double price() {
// TODO Auto-generated method stub
return 5000;
}
public double weight() {
// TODO Auto-generated method stub
return 4.2;
}
}
调用代码:
ComputerFactory factory=new SamsungComputerFactory();
Computer computer=factory.createComputer();
System.out.println(computer.price());
什么时候使用工程方法
1) 当客户程序不需要知道要使用对象的创建过程。
2) 客户程序使用的对象存在变动的可能,或者根本就不知道使用哪一个具体的对象。
小结:
简单工厂模式与工厂方法模式真正的避免了代码的改动了?没有。在简单工厂模式中,新产品的加入要修改工厂角色中的判断语句;而在工厂方法模式中,要么将判断逻辑留在抽象工厂角色中,要么在客户程序中将具体工厂角色写死(就象上面的例子一样)。而且产品
对象创建条件的改变必然会引起工厂角色的修改。
面对这种情况,Java 的反射机制与配置文件的巧妙结合突破了限制——这在Spring 中完美的体现了出来。
参考:
http://blog.csdn.net/yuan22003/article/details/6709649
http://www.cnblogs.com/java-my-life/archive/2012/03/25/2416227.html
http://men4661273.iteye.com/blog/1638379
《JAVA与模式》之简单工厂与工厂方法的更多相关文章
- Java设计模式2:简单工厂模式
简单工厂模式 简单工厂模式是类的创建模式,又叫做静态工厂方法模式.简单工厂模式由一个工厂对象决定生产出哪一种产品类的实例. 为什么要使用简单工厂模式 原因很简单:解耦. A对象如果要调用B对象,最简单 ...
- Java学习笔记——Java工厂模式之简单工厂
package com.app; import java.util.Date; /* * 工厂模式:简单工厂.工厂方法.抽象工厂 * * */ public class Test0718_Factor ...
- 设计模式(Java版)-创建型模式之简单工厂模式
前言:这段时间在学习设计模式,本人也是小菜一枚(所以写的如果有错误的地方请大大们给予指出).这个东西也是我一直想学习的,从点点滴滴做起,记录下自己每天的领悟! 一.工厂模式的动机 在软件系统中,经常面 ...
- Java设计模式---工厂模式(简单工厂、工厂方法、抽象工厂)
工厂模式:主要用来实例化有共同接口的类,工厂模式可以动态决定应该实例化那一个类.工厂模式的形态工厂模式主要用一下几种形态:1:简单工厂(Simple Factory).2:工厂方法(Factory M ...
- Java设计模式之(工厂模式)--简单工厂模式--工厂方法模式--抽象工厂模式
工厂模式: 工厂模式可以分为三类: 1)简单工厂模式(Simple Factory) 2)工厂方法模式(Factory Method) 3)抽象工厂模式(Abstract Factory) 简单工厂模 ...
- 《JAVA与模式》之简单工厂模式
在阎宏博士的<JAVA与模式>一书中开头是这样描述简单工厂模式的:简单工厂模式是类的创建模式,又叫做静态工厂方法(Static Factory Method)模式.简单工厂模式是由一个工厂 ...
- Java设计模式学习记录-简单工厂模式、工厂方法模式
前言 之前介绍了设计模式的原则和分类等概述.今天开启设计模式的学习,首先要介绍的就是工厂模式,在介绍工厂模式前会先介绍一下简单工厂模式,这样由浅入深来介绍. 简单工厂模式 做法:创建一个工厂(方法或类 ...
- JAVA基础——设计模式之简单工厂模式
在阎宏博士的<JAVA与模式>一书中开头是这样描述简单工厂模式的:简单工厂模式是类的创建模式,又叫做静态工厂方法(Static Factory Method)模式.简单工厂模式是由一个工厂 ...
- java设计模式-----1、简单工厂模式
简单工厂模式是属于创建型模式,又叫做静态工厂方法(Static Factory Method)模式,但不属于23种GOF设计模式之一.简单工厂模式是由一个工厂对象决定创建出哪一种产品类的实例,简单来说 ...
随机推荐
- AI单挑Dota 2世界冠军:被电脑虐哭……
OpenAI的机器人刚刚在 Dota2 1v1 比赛中战胜了人类顶级职业玩家 Denti.以建设安全的通用人工智能为己任的 OpenAI,通过“Self-Play”的方式,从零开始训练出了这个机器人. ...
- Android 演示 Android ListView 和 github XListView(1-3)
本文内容 环境 项目结构 演示 1:ListView 演示 2:简单 XListView 演示 3:音乐列表 XListView 演示 4:另一个音乐列表 XListView 本文四个演示,循序渐进. ...
- Android 从 Android 本地图库选择多个图片
原文地址 本文说明如何从 Android 本地图库选择多个图片.作者考虑很多解决方案. 演示从 Android 本地图库选择多个图片,有两个方法可以实现从图库中选择多个图片: 用 Intent 获取多 ...
- input[type="checkbox"]与label对齐
项目中遇到文字与 checkbook 无法水平对齐, 源码如下: <div align='center'> <input type="checkbox" id=& ...
- 深度学习-Caffe编译测试的小总结
1. 搭建的环境和代码:win7 64bit + vs2013+CUDA7.5 http://blog.csdn.net/thesby/article/details/50880802 2. 编译,制 ...
- Webwork【04】Configuration 详解
Webwork做为经典的Web MVC 框架,个人觉得源码中配置文件这部分代码的实现十分考究. 支持自定义自己的配置文件.自定义配置文件读取类.自定义国际化支持. 可以作为参考,单独引入到其他项目中, ...
- MySQL参数化查询的IN 和 LIKE
https://stackoverflow.com/questions/650455/c-sharp-parameterized-query-mysql-with-in-clausehttps://s ...
- Xamarin.Android之SQLite.NET ORM
一.前言 通过<Xamarin.Android之SQLiteOpenHelper>和<Xamarin.Android之ContentProvider>的学习,我们已经掌握了如何 ...
- Android开发之使用DefaultHandler处理XML数据
一.定义规则 XML数据结构定义 请记住上面的定义,后面我会用“标签开始”.“文本”.“标签结束”表示SAX正在处理哪部分XML数据 事件模型 为什么这里我要谈到这个,因为SAX处理XML数据是采用事 ...
- python之函数用法get()
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法get() #http://www.runoob.com/python/att-dic ...