JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Software Design » GoF  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 [DP]Factory pattern, Abstract Factory pattern (by Biologic) [精華]
popcorny

Jakarta 2%

版主

發文: 752
積分: 20
於 2003-07-19 16:19 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Factory Pattern,

工廠的作用就是生產. 簡單說我們指定我們需要的產品名稱, 然後工廠負責把產品生出來. 最常看到的例子是 java.sql.DriverManager. 我們指定 url 然後由 DriverManager, (or also, 在 DriverManager 註冊的 sevice) 來把我們指定的 Connection 建立出來.

好處是我們不需要去知道原形是什麼, 也不需要他內部的處理方式如何, 反正我們收到的物件會依照 interface 的特性來處理我們的需求. 目前我看過的 Factory Pattern 的應用跟設計太廣, 且每種都不太一樣... 所以僅供參考. 有一些設計跟 abstract factory pattern 幾乎一樣...

事實上在 Java 內還有一種也可以算是 Factory. 可以慢慢思考

UML: 不知道對不對, 僅供參考與 x ㄍ一ㄠ使用


reply to postreply to post
話題樹型展開
人氣 標題 作者 字數 發文時間
14164 [精華] [DP]Factory pattern, Abstract Factory pattern (by Biologic) popcorny 422 2003-07-19 16:19
12611 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) Biologic 312 2003-07-19 16:47
12446 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) popcorny 96 2003-07-19 16:56
12400 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) Biologic 135 2003-07-19 17:03
12326 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) ymshin 149 2003-07-19 17:21
12455 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) Biologic 127 2003-07-19 16:51
12659 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) Millerlai 621 2003-07-20 23:10
12501 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) Biologic 608 2003-07-21 08:51
12435 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) popcorny 256 2003-07-21 10:30
12315 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) koji 33 2003-07-23 00:47
12261 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) Biologic 82 2003-07-23 09:14
12305 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) koji 136 2003-07-23 10:30
12239 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) popcorny 289 2003-07-23 11:26
12229 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) ymshin 250 2003-07-23 11:35
12284 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) koji 306 2003-07-23 12:19
12682 Re:[DP]Factory pattern, Abstract Factory pattern (by Biologic) ymshin 231 2003-07-23 15:34
» JWorld@TW »  Software Design » GoF

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8