
架构设计
文章平均质量分 60
null_ptr
这个作者很懒,什么都没留下…
展开
-
4+1视图
逻辑视图(Logical View),设计的对象模型(使用面向对象的设计方法时)。过程视图(Process View),捕捉设计的并发和同步特征。物理视图(Physical View),描述了软件到硬件的映射,反映了分布式特性。开发视图(Development View),描述了在开发环境中软件的静态组织结构。架构的描述,即所做的各种决定,可以围绕着这四个视图来组织,然后由一些用例原创 2013-02-17 21:02:59 · 479 阅读 · 0 评论 -
C语言设计模式:状态模式
http://blog.youkuaiyun.com/derek_yi/article/details/8576176CPP的状态机实现搞的很复杂,C中的实现很简单,一个状态机,有状态变量,和切换状态的流程即可:int state = 0;int switch(){ switch(state){ case 0: state = 1;break原创 2013-02-11 20:55:50 · 1039 阅读 · 0 评论 -
行为模式: Mediator(中介者)
With the mediator pattern, communication between objects is encapsulated with a mediator object. Objects no longer communicate directly with each other, but instead communicate through the mediator. T转载 2013-02-07 20:43:47 · 260 阅读 · 0 评论 -
C语言设计模式:责任链、观察者和访问者
这三种模式太雷同了。责任链:In Object Oriented Design, the chain-of-responsibility pattern is a design pattern consisting of a source of command objects and a series ofprocessing objects. Each processing object c原创 2013-02-11 18:25:50 · 1077 阅读 · 0 评论 -
C语言设计模式:外观模式
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can:make a software library easier to use, understand and test, since the转载 2013-02-11 18:51:21 · 647 阅读 · 0 评论 -
行为模式:State(状态)
The state interface and two implementations. The state's method has a reference to the context object and is able to change its state.interface Statelike { /** * Writer method for the转载 2013-02-07 20:54:54 · 346 阅读 · 0 评论 -
行为模式: Template Method(模板方法)
abstract class Generalization { // 1. Standardize the skeleton of an algorithm in a "template" method public void findSolution() { stepOne(); stepTwo(); stepThr(); stepFo转载 2013-02-07 21:03:25 · 267 阅读 · 0 评论 -
C语言设计模式:单件模式
http://blog.youkuaiyun.com/feixiaoxing/article/details/7071202上面这个家伙有一系列的C语言设计模式解析,写的不错。个人懒得整理,打算逐一学习一下,不认可的再想办法。单件模式摘录代码如下,这个比较靠谱://部分地方提到的多件模式,就很简单,增加一个索引参数即可。[cpp] view plaincopy原创 2013-02-11 17:12:20 · 458 阅读 · 0 评论 -
C语言设计模式:原型模式
http://blog.youkuaiyun.com/feixiaoxing/article/details/7075316原型模式简单的理解,就是支持两个对象的复制。原文有些啰嗦,修改如下:1)结构体增加复制接口[cpp] view plaincopytypedef struct _DATA { struct _DATA*原创 2013-02-11 17:19:55 · 543 阅读 · 0 评论 -
创建型模式:Prototype(原型)
WIKI:http://zh.wikipedia.org/wiki/%E5%8E%9F%E5%9E%8B%E6%A8%A1%E5%BC%8F原型模式是创建型模式的一种,其特点在于通过「复制」一个已经存在的实例来返回新的实例,而不是新建实例。被复制的实例就是我们所称的「原型」,这个原型是可定制的。原型模式多用于创建复杂的或者耗时的实例,因为这种情况下,复制一个已经存在的实例使程序原创 2013-02-05 22:23:32 · 428 阅读 · 0 评论 -
结构型模式:Decorator(装饰)
http://zh.wikipedia.org/wiki/%E4%BF%AE%E9%A5%B0%E6%A8%A1%E5%BC%8F通过使用修饰模式,可以在运行时扩充一个类的功能。原理是:增加一个修饰类包裹原来的类,包裹的方式一般是通过在将原来的对象作为修饰类的构造函数的参数。装饰类实现新的功能,但是,在不需要用到新功能的地方,它可以直接调用原来的类中的方法。修饰类必须和原来的类原创 2013-02-05 22:52:57 · 303 阅读 · 0 评论 -
创建型模式:Builder(生成器)
The builder pattern is an object creation software design pattern. The intention is toabstract steps of construction of objects so thatdifferent implementations of these steps can construct differ原创 2013-02-05 22:30:06 · 280 阅读 · 0 评论 -
行为模式:Memento(备忘录)
The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo via rollback).The memento pattern is implemented with two objects: the orig转载 2013-02-07 20:36:30 · 268 阅读 · 0 评论 -
界面编程?
1、VC-MFC2、VB、VB.NET3、QT4、web? html + css + js5、wpf可以和c# vb以及c 配合6、VB+WINFORM、c#+winform7、GTK8、delphi9、wxpython10、Eclipse+Flash11、html+jquery原创 2013-02-16 21:23:38 · 271 阅读 · 0 评论 -
软件开发2:代码检视
看见了if,就想else;看见malloc,就去找free;函数调用要小心,需要看看返回值;看见for循环,就找边界值;看见return要注意,要去前面找资源;看见数组把神提,问题往往在下标;不要小看字符串,长度是个大问题;得到函数不要急,看看变量初始化,各种路径要小心;赋值函数最危险,变量没有初始化。转载 2014-11-05 22:51:33 · 1420 阅读 · 0 评论 -
软件的质量属性
1 软件的质量属性如果要我们描述一个人,我们会说,他的年龄多少,性别是什么,姓名是什么,等等。这些年龄,性别和姓名等,就是一个人的属性。类比的,软件也有属性,本文将讨论一下和软件质量相关的一些重要的属性。2.1 正确性(Correctness)正确性是软件最基本,最重要的属性。他代表了这个软件能够正确的执行计算并给出用户正确的结果。如果软件不能保证正确性,那么这个软件将没有转载 2013-02-03 22:17:44 · 4277 阅读 · 0 评论 -
分层与模块设计:头文件
做“平台”的简单思路:------------------------------------------------------------------------------------------------------------------------------------\include-- config.h //平台配置文件-- type.h //平台基本类型定义文原创 2013-02-25 22:22:35 · 800 阅读 · 0 评论 -
How to Design a Good API and Why it Matters
http://wenku.baidu.com/link?url=DNX_g0Q2q3oWM5PaAZUjUVQU09CigFjf9Qr87d1ZY2RhoEwNoUbzQ0OOYfgvlUFGBq_H0VRHBWcbW7ikzsPSTWwfZolFKXBMeIngv3Rv_SqCharacteristics of a Good API• Easy to learn• E转载 2015-01-31 20:54:54 · 727 阅读 · 0 评论 -
C语言设计模式:构造者模式
构造者模式是创建型模式的一种。构造者模式在CPP中的应用是,将对象的创建过程切片,针对每个分片,不同的工厂有不同的创建方法。--和工厂模式的区别在于切片。C中创建一个对象很简单,分配内存,初始化即可。因此“切片”可以简单理解为初始化的分级(stage)。http://blog.youkuaiyun.com/feixiaoxing/article/details/7169888原创 2013-02-15 18:21:35 · 338 阅读 · 0 评论 -
C语言设计模式:装饰模式
装饰模式的本质在运行期扩展一个类的功能:通过包裹类继承原有方法并扩展新的方法。装饰模式可看成继承功能的一种,C中很少使用继承,勉强使用,可以看成结构体的包含。如下:1)例1,ipv4扩展后支持ipv6:[cpp] view plaincopytypedef struct _ipaddr { char ip_addr原创 2013-02-15 18:40:39 · 628 阅读 · 0 评论 -
C语言设计模式:备忘录
备忘录模式主要目的用于支持undo操作。考虑到C是一种结构化语言,撤销操作往往在每个返回处理进行回滚,或者通过goto出口统一释放资源。如果将回滚操作对象化,即勉强可看为该模式的一种实现。void func() { ret = do_sth1() & rollback_reg(sth1); if (ok != ret) {原创 2013-02-15 19:01:37 · 680 阅读 · 0 评论 -
C语言设计模式:解释器 //tbd
解释器模式主要用于词法识别。词法识别可用状态机实现,也可以用解释器(根据字节或单词进行处理)。原创 2013-02-15 19:13:53 · 411 阅读 · 0 评论 -
C语言设计模式:组合模式
The composite pattern describes thata group of objects are to be treated in the same way as a single instance of an object.The intent of a composite is to "compose" objects into tree structures to r原创 2013-02-11 17:44:13 · 1592 阅读 · 1 评论 -
C语言设计模式:代理模式、桥接与中介模式 //tbd
Proxy: Provide a surrogate or placeholder for another object to control access to it.Bridge: Decouple an abstraction from its implementation allowing the two to vary independently.Mediator: Def原创 2013-02-11 18:56:44 · 785 阅读 · 0 评论 -
结构型模式:Facade(外观)
http://zh.wikipedia.org/wiki/%E5%A4%96%E8%A7%80%E6%A8%A1%E5%BC%8F/* Complex parts */ class CPU { public void freeze() { ... } public void jump(long position) { ... }原创 2013-02-05 22:55:42 · 236 阅读 · 0 评论 -
行为模式:Chain Of Responsibility(职责链)
import java.util.*; abstract class Logger { public static int ERR = 3; public static int NOTICE = 5; public static int DEBUG = 7; protected int mask; // The next element in th转载 2013-02-07 19:48:46 · 286 阅读 · 0 评论 -
结构型模式:Flyweight(享元)
import java.util.HashMap;import java.util.Map; // Flyweight object interfaceinterface CoffeeOrder { public void serveCoffee(CoffeeOrderContext context);} // ConcreteFlyweight object that cr转载 2013-02-07 20:25:00 · 275 阅读 · 0 评论 -
结构型模式: Composite(组合)
/** "Component" */interface Graphic { //Prints the graphic. public void print();} /** "Composite" */import java.util.List;import java.util.ArrayList;class CompositeGraphic implements转载 2013-02-07 20:39:45 · 303 阅读 · 0 评论 -
创建型模式:Abstract Factory(抽象工厂)
WIKI:http://zh.wikipedia.org/wiki/%E6%8A%BD%E8%B1%A1%E5%B7%A5%E5%8E%82%E6%A8%A1%E5%BC%8Fabstract class AbstractProductA{ public abstract void operationA1(); public abst原创 2013-02-04 23:54:52 · 318 阅读 · 0 评论 -
行为模式:Command(命令)
/* The Command interface */public interface Command { void execute();} import java.util.List;import java.util.ArrayList; /* The Invoker class */public class Switch { private ListCommand>转载 2013-02-07 20:42:19 · 331 阅读 · 0 评论 -
行为模式: Visitor(访问者)
using System;using System.Collections; namespace Wikipedia.Patterns.Strategy{ // IObserver --> interface for the observer public interface IObserver { // ca转载 2013-02-07 20:10:56 · 256 阅读 · 0 评论 -
行为模式:Observer(观察者)
Below is an example written in Java that takes keyboard input and treats each input line as an event. The example is built upon the library classesjava.util.Observer and java.util.Observable. When转载 2013-02-07 20:52:59 · 292 阅读 · 0 评论 -
行为模式:Interpreter(解释器)
The following Reverse Polish notation example illustrates the interpreter pattern. The grammarexpression ::= plus | minus | variable | numberplus ::= expression expression '+'minus ::= express转载 2013-02-07 20:45:59 · 248 阅读 · 0 评论 -
创建型模式:Multiton(多例模式)
原文来自:JAVA设计模式之禅完整版.pdfimport java.util.*;class Emperor { private static int maxNumOfEmperor = 2; //最多只能有2个皇帝 private static ArrayList emperorInfoList=new ArrayList(maxNumOfEmperor);原创 2013-02-05 22:16:02 · 413 阅读 · 0 评论 -
结构型模式:Bridge(桥接)
http://zh.wikipedia.org/wiki/%E6%A9%8B%E6%8E%A5%E6%A8%A1%E5%BC%8F/** "Implementor" */interface DrawingAPI{ public void drawCircle(double x, double y, double radius);} /** "Concret原创 2013-02-05 22:47:45 · 301 阅读 · 0 评论 -
结构型模式:Adapter(适配器)
http://en.wikipedia.org/wiki/Adapter_pattern /* The OLD */class SquarePeg { private double width; public SquarePeg( double w ) { width = w; } public double getWidth()原创 2013-02-05 22:45:09 · 293 阅读 · 0 评论 -
C语言设计模式:策略模式
WIKI:In computer programming, the strategy pattern (also known as the policy pattern) is a software design pattern, whereby an algorithm's behaviour can be selected at runtime.Formally speaking, the原创 2013-02-11 19:56:37 · 1315 阅读 · 0 评论 -
C语言设计模式:命令模式 //tbd
Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.Four terms always associated with the原创 2013-02-11 21:05:26 · 771 阅读 · 0 评论 -
C语言设计模式:迭代器
C语言实现迭代器有很多方法,linux内核的经典代码在文件include\linux\list.h中:#define LIST_POISON1 ((void *) 0x00100100)#define LIST_POISON2 ((void *) 0x00200200)struct list_head {struct list_head *next, *pr原创 2013-02-11 18:45:16 · 810 阅读 · 0 评论 -
C语言设计模式:工厂和抽象工厂
http://blog.youkuaiyun.com/feixiaoxing/article/details/7081243http://blog.youkuaiyun.com/feixiaoxing/article/details/7089626这哥们两个例子举得非常好。工厂就是提取产品的一个维度,抽象工厂就是多个维度,甚至于把工厂也抽象了。如果说工厂模式搞多个参数支持多个维度,也行,但转载 2013-02-11 18:09:18 · 480 阅读 · 0 评论