クリエイショナルパターンは、オブジェクト作成に関する—オブジェクトがどのようにインスタンス化され、柔軟に作成され、使用するコードから分離されるかに対する—パターンです。Singleton、Factory、Builder、Prototype、Abstract Factoryが含まれます。
クリエイショナルパターンが対処する問題
CREATIONAL patterns abstract and control HOW objects are CREATED:
→ instead of directly calling constructors everywhere (rigid, coupled), creational
patterns make object creation flexible, decoupled, and manageable
→ they help create objects in a way suited to the situation, decoupled from concrete classes
主なクリエイショナルパターン
SINGLETON → ensure only ONE instance of a class (single shared object)
FACTORY METHOD → create objects without specifying the exact class (defer to a method/subclass)
ABSTRACT FACTORY → create FAMILIES of related objects (without specifying concrete classes)
BUILDER → construct complex objects step-by-step (separate construction from representation);
good for objects with many optional parts/parameters
PROTOTYPE → create new objects by CLONING an existing one (copy a prototype)
