Gof Abstract Factory

Abstract Factory in modern Java: the pattern exists to keep a _family_ of related objects mutually consistent when the family varies, not to centralise construction. Covers the family invariant that justifies it, why dependency injection already resolves the deployment-time case, when per-request or per-tenant selection benefits from a family provider, and how to express it as a record of suppliers or a sealed provider rather than a four-level interface hierarchy. Use when a factory interface is proposed, when profile-specific object graphs are being built by hand, when a family of parser/renderer/validator types must never be mixed across formats, when a plugin SPI must supply several related types at once, or when reviewing a factory whose products have nothing to do with each other. Does not cover single-product creation (gof-factory-method), assembling one complex object (gof-builder), copying an existing instance (gof-prototype), or wiring policy in general (java-dependency-inversion).

robsonkades Updated

File contents

robsonkades/agent-skills/tree/main/skills/gof-abstract-factory commit 2c2cfc36c7

Frequently asked questions

npx skillmds@latest add robsonkades/gof-abstract-factory