设计模式之序-UML类图那点事儿序 打14年年底就像写那么一个系列,用于讲设计模式的,代码基于JAVA语言,最早接触设计模式是大一还是大二来着,那时候网上有人给推荐书,其中就有设计模式,当时给我推荐的书我还隐约记得,叫GoF的,书名是《Design Patterns: Elements of Re....
分类:
其他好文 时间:
2015-01-14 22:33:22
阅读次数:
226
一、策略模式的相关介绍1、定义:策略模式定义了一系列的算法,并将每一个算法封装起来,而且使它们还可以相互替换。策略模式让算法独立于使用它的客户而独立变化。2、举例:商场中卖商品有原件、打折和满m元就减n元多种策略,可以将它们封装起来,然后通过策略类让这些方法可以被客户端选择。3、UML图:】4、C+...
分类:
其他好文 时间:
2015-01-13 14:09:39
阅读次数:
154
??
A relationship is a connection among things. In object-oriented
modeling, the three most important relationships are dependencies, generalizations, and associations. Graphically, a relatio...
分类:
其他好文 时间:
2015-01-13 07:55:07
阅读次数:
207
Relationships
关联
When you build abstractions, you’ll discover that very few of your classes stand alone. Instead, most of them collaborate with others in a number of ways. Therefore, when you...
分类:
其他好文 时间:
2015-01-13 07:54:25
阅读次数:
149
??
Associations
联合
An
association
is a structural relationship that specifies that objects of one thing are connected to objects of another. Given an association connecting two classes, yo...
分类:
其他好文 时间:
2015-01-13 07:53:53
阅读次数:
139
??
If you are building a house, things like walls, doors, windows, cabinets, and lights will form part of your vocabulary. None of these things stands alone, however. Walls connect to other wal...
分类:
其他好文 时间:
2015-01-13 07:52:36
阅读次数:
215
??
Other Features
其它特征
Plain, unadorned dependencies, generalizations, and associations with names, multiplicities, and roles are the most common features you’ll
need when creating abst...
分类:
其他好文 时间:
2015-01-13 07:52:15
阅读次数:
231
学习设计模式之前,总是需要UML来辅助UML的入门设计模式的灵魂在于:灵活地多态,继承,封装。把你所描述的类,抽象出一个关键词,形成父类,再把他继承。实现接口但是继承还是不太好,因为增加了很多冗余成分,所以产生了组合。运用组合实现了多态里面的东西对话的形式来写技术可能会更好啊。老板:小朱啊,今天给我...
分类:
其他好文 时间:
2015-01-12 23:43:34
阅读次数:
255
一、简单工厂模式的相关概念:简单工厂模式是属于创建型模式,又叫做静态工厂方法(Static Factory Method)模式。其核心思想就是有一个专门的工厂类根据传入的参数,动态决定应该创建哪一个产品类(这些产品类继承自一个父类或接口)的实例。UML图如下:每个类的主要功能:简单工厂:简单工厂模式...
分类:
其他好文 时间:
2015-01-12 14:19:47
阅读次数:
180
??
Modeling Primitive Types
构建原始类型模型
At the other extreme, the things you model may be drawn directly from the programming language you are using to implement a solution. Typically, these abs...
分类:
其他好文 时间:
2015-01-12 11:37:04
阅读次数:
192