FactoryMethodFactory 方法模式(建立型)作用:Factory 方法模式是一種建立型模式,它是由子類來決定執行個體哪個類,多個子類都實現了介面,Factory 方法根據用戶端或目前狀態的外部提供的資訊執行個體化對應的子類。RoleThe Factory Method pattern is a way of creating objects, but letting subclasses decide exactly which class to
Interpreter解譯器模式(行為型)作用支援語言或符號的指令解釋,這些符號精確的以某種文法定義。The Interpreter pattern supports the interpretation of instructions written in a language or notation defined for a specific purpose. The notation is precise and can be defined in terms of a grammar.
作用:Singleton單例模式目的在於確保一個類只有唯一的一個執行個體,並且這個唯一執行個體只有一個全域訪問點。它確保類被執行個體一次,所有這個類的請求都指向這個唯一的執行個體。另外,這個對象不是在需要的時候才被建立。在Singleton單例模式中,是由單例類來保證這種約束的,而不是用戶端通過其他方法實作類別的唯一執行個體。RoleThe purpose of the Singleton pattern is to ensure that there is only one instance
State狀態模式(行為型)作用狀態模式可以看作是策略模式的動態版本。當對象狀態發生變化時,它的行為也裝換成另一組操作了。通過在一個體系中切換對象的子類實現狀態變化和行為變換。Rolethe State pattern, can be seen as a dynamic version of the Strategy pattern. When the state inside an object changes, it can change its behavior
下面這種方式可以建立table,並附加到Dom樹中,但是在IE中是不顯示的: var table = document.createElement("TABLE"); var tr = document.createElement("TR"); var td = document.createElement("TD"); var text = document.createTextNode("text"); td.appendChild(text); tr.appendChild(td);
ChainOfResponsibility責任鏈模式(行為型) 作用:責任鏈模式由一條鏈上的各個對象組成,每個對象可以處理自己範圍內的請求,超出自己處理範圍的發送到鏈上的上一個對象處理。在鏈的末端是預設的處理對象或是異常。 RoleThe Chain of Responsibility pattern works with a list of Handler objects that have limitations on the nature of the requests they can
TemplateMethod模版方法模式(行為型)作用模版方法使演算法的具體步驟延遲到子類實現。演算法的結構穩定,但是演算法內部細分的操作可以在其他地方實現。RoleThe Template Method pattern enables algorithms to defer certain steps to subclasses. The structure of the algorithm does not change, but small well-defined
Command命令模式(行為型)作用:命令模式分離用戶端的操作請求和請求的執行者。這種模式非常有用,它支援:1、發送請求給多個接受著2、排隊、日誌、拒絕請求3、原始、簡單的操作組合成高層事務4、重做、撤銷功能RoleThe Command pattern creates distance between the client that requests an operation and the object that can perform it. This pattern is
不知您是否遇到過這樣的情況,當您用Flash幫同事製作完成了一個課件,可同事認為課件中的字型使用的不太合適,希望把其中的某一種字型全部改為另一種字型。你會如何去完成這項工作呢?在課件中一處一處地更改嗎?如果只是幾處使用了這種字型,問題不大,但如果該字型使用得很多,工作量就太大了,而且很容易遺漏。那麼有沒有更快捷的方法呢?一起來看看吧。其實方法也很簡單,就是利用Flash中Movie Explorer(影片瀏覽器)提供的尋找功能。 工具介紹 Movie
Linq實戰 --Linq in action WCF揭秘 --Windows Communication Foundation UnleashedLinq 對象關係映射--Pro LINQ Object Relational Mapping in C#===================================================================C#編程風格-
Strategy策略模式(行為型)作用策略模式將類中的演算法分離出放在一個單獨的類中。不同的演算法適用於不同的問題。如果所有的演算法都集中在一個類中定會導致帶有條件選擇的雜亂的代碼。策略模式使得用戶端能夠輕鬆的從一系列演算法中找出適合自己的演算法。這些演算法可以不依賴他們用到的資料來表示。RoleThe Strategy pattern involves removing an algorithm from its host class and putting it in a separate