Bill.Lin's Notes
  • Me
  • Posts
  • Categories
  • Tags
  • Search
#

Creational

標籤 · 4 篇文章

Prototype — 透過複製建立新物件

GoF Prototype 模式:比較淺拷貝與深拷貝的陷阱,說明為何應避免 Cloneable,以及拷貝建構子與 Jackson 序列化的現代替代方案

2018-08-07 ·
#DesignPattern #Creational #Prototype

Builder — 分離複雜物件的建構與表示

GoF Builder 模式:用流式介面解決 telescoping constructor 問題,比較 Lombok @Builder 底層實作與 Java Records 的適用邊界

2018-08-07 ·
#DesignPattern #Creational #Builder

Factory Method — 讓子類決定實例化哪個類別

GoF Factory Method 模式:定義建立物件的介面,將具體類別的決策交給子類,並釐清與 Simple Factory、Abstract Factory、靜態工廠的差異

2018-08-07 ·
#DesignPattern #Creational #FactoryMethod

Singleton — 確保唯一實例

GoF Singleton 模式四種實作比較:Enum、Holder、DCL、Eager,說明 Spring Bean Singleton 與 GoF 的本質差異

2018-08-06 ·
#DesignPattern #Creational #Singleton
← 回到所有標籤

© 2026 Bill Lin. All rights reserved.

github linkedin email