Quantcast
Channel: Frank Sun » Design Pattern
Browsing all 13 articles
Browse latest View live

算法总结系列之八:复读机的故事 –散列表.NET应用的研究(下集)

估计写这么个题目会被扔鸡蛋, 因为实在是太大了. 各位不要期望太高啊,我写这东西,就是为了给自己个备忘. 你们要是把它当垃圾看, 说不定还能发现点什么东西. 言归正题. 说实话, .NET Framework的实现可能比我们认为的要好一些, 比如线程安全, 代码效率, 甚至以及代码风格方面. 比如HashTable 的实现就是一个比较好的佐证. 上文说到, .NET Framework 中的哈希表,...

View Article


Different types of Iterative Algorithms

Here are a few classic types of iterative algorithms to help you design a measure of progress and a loop invariant. More of the Output:  if the solution is a structure composed of many pieces (e.g., an...

View Article


Design Iterative Algorithms

If you are designing describing and proving correct an algorithm using loop invariants, the following is the list the things must consider. Specification: Define the problem (pre and post conditions):...

View Article

Introduction to Dynamic Programming

Dynamic programming is a method for efficiently solving a broad range of search and optimization problems which exhibit the characteristics of overlappling subproblems and optimal substructure. I’ll...

View Article

Design Pattern: Factory

from: http://www.jdon.com/designpatterns/designpattern_factory.htm 工厂模式定义:提供创建对象的接口. 为何使用?工厂模式是我们最常用的模式了,著名的Jive论坛 ,就大量使用了工厂模式,工厂模式在Java程序系统可以说是随处可见。...

View Article


Strategy Pattern

from: http://www.oodesign.com/strategy-pattern.html Motivation There are common situations when classes differ only in their behavior. For this cases is a good idea to isolate the algorithms in...

View Article

关于23种设计模式的有趣见解(

创建型模式 1、FACTORY—追MM少不了请吃饭了,麦当劳的鸡翅和肯德基的鸡翅都是MM爱吃的东西,虽然口味有所不同,但不管你带MM去麦当劳或肯德基,只管向服务员说“来四个鸡翅”就行了。麦当劳和肯德基就是生产鸡翅的Factory...

View Article

Design Principle

1. Separating what changes from what stays the same   - Take the parts that vary and encapsulate them, so that later you can alter or extend the parts that vary without affecting those that...

View Article


Singleton Pattern

from: http://www.oodesign.com/singleton-pattern.html Motivation Sometimes it’s important to have only one instance for a class. For example, in a system there should be only one window manager (or only...

View Article


Decorator Pattern

from: http://www.oodesign.com/decorator-pattern.html Motivation Extending an object�s functionality can be done statically (at compile time) by using inheritance however it might be necessary to extend...

View Article

DAO如何与业务层解耦

在没有使用代理模式的时候,使用者和被使用者耦合。 使用代理模式之后,使用者和代理耦合,代理和被使用者耦合。 为什么要解耦呢?通常是应为变化,需求变化导致最终的程序实现变化,如果耦合度高,出现变化时所需要修改的程序就多,如果进行解耦,那修改的程序就少(被解耦的部分已经不需要修改,因为和变化的地方没有直接的关系了)。   下面举个不太恰当的例子。...

View Article

J2EE中几种业务代理模式的实现和比较

什么是业务代理模式(buiness proxy)? 在J2EE系统中,一般划分为表现层和业务逻辑层,为实现表现层和业务逻辑层之间的最大限度解耦,引入业务代理模式,这样,当表现层或业务逻辑层具体实现技术发生时,对彼此的影响很小,当然,如果希望实现完全解耦,我们可以使用消息系统JMS来实现,本文章只讨论同步系统范畴。...

View Article

Annotation与工厂模式解耦dao与service

开发中往往service、dao并行完成,但是service层又需要调用dao层的CRUD方法,这意味着dao必须先于service完成。这在开发中会极大降低效率的。 通过注解(Annotatoin)我们可以轻松实现两个层次的解耦   首先写一个注解类 @Retention(RetentionPolicy.RUNTIME) public @interface getClassAnnotation{...

View Article

Browsing all 13 articles
Browse latest View live