{"id":"6b08bd2e80884893657cc8d4","slug":"abstract-factory","title":"Abstract Factory – whole families of objects that fit together","summary":"Abstract Factory creates a complete set of related objects from one family and makes sure nobody mixes parts from different sets. An example with two payment provider integrations.","servedLang":"en","availableLangs":["pl","en"],"topics":["abstract-factory","factory-method","singleton"],"techs":["dotnet","typescript","java","go","python"],"tags":["gof","creational","abstract-factory","product-families"],"level":"intermediate","kind":"article","access":"members","status":"published","cover":null,"author":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","community":false},"readingMinutes":11,"stats":{"views":3,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-26T23:13:50.779Z","updatedAt":"2026-11-27T13:14:05.213Z","requestedLang":"en","theme":{"hero":"minimal","heroMedia":null,"accent":"green","background":"grid","weaveResources":true,"toc":"right"},"seoDescription":"The Abstract Factory design pattern – the problem of mixing object families, a UML diagram, code in C#, TypeScript, Java, Go and Python, pros, cons, and examples from .NET, JDBC and Django.","wordCount":2108,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"When an application uses several objects that must come \"from the same set\", individual "},{"type":"text","text":"new","marks":[{"type":"code"}]},{"type":"text","text":" calls scattered around the code are asking for trouble. "},{"type":"text","text":"Abstract Factory","marks":[{"type":"bold"}]},{"type":"text","text":" is one object that produces a whole family of collaborating products – and guarantees they all belong to the same family."}]},{"type":"callout","attrs":{"variant":"info","title":"In short"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"The factory interface has one method per kind of product ("},{"type":"text","text":"createCharger()","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"createVerifier()","marks":[{"type":"code"}]},{"type":"text","text":"…)."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Each concrete factory is one family: all its products are compatible with each other."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"The client receives the factory from outside and knows no concrete class – switching families means swapping one object."}]}]}]}]},{"type":"heading","attrs":{"level":2,"id":"the-problem-payment-from-one-provider-webhook-from-another"},"content":[{"type":"text","text":"The problem: payment from one provider, webhook from another"}]},{"type":"paragraph","content":[{"type":"text","text":"An online shop supports two payment providers: the international "},{"type":"text","text":"GlobalPay","marks":[{"type":"bold"}]},{"type":"text","text":" (cards) and the local "},{"type":"text","text":"Przelewik","marks":[{"type":"bold"}]},{"type":"text","text":" (instant bank transfers). Each provider has its own way of charging the customer and its own signature format for the notifications ("},{"type":"text","text":"webhooks","marks":[{"type":"italic"}]},{"type":"text","text":") that confirm a payment. The code was written at different times by different people:"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"checkout.ts / webhooks.ts"},"content":[{"type":"text","text":"// checkout.ts\nconst charger = config.provider === \"globalpay\" ? new GlobalPayCharger() : new PrzelewikCharger();\n\n// webhooks.ts – written by someone else, months later\nconst verifier = process.env.PSP === \"przelewik\" ? new PrzelewikVerifier() : new GlobalPayVerifier();"}]},{"type":"paragraph","content":[{"type":"text","text":"Two sources of configuration, two conditions, zero guarantee of consistency. One typo in an environment variable and GlobalPay takes the money while Przelewik's module verifies the notifications – rejecting every single one as forged. Orders stay \"unpaid\" even though customers paid. On top of that, adding a third provider means hunting down every such condition across the repository."}]},{"type":"heading","attrs":{"level":2,"id":"the-solution-one-object-for-the-whole-family"},"content":[{"type":"text","text":"The solution: one object for the whole family"}]},{"type":"paragraph","content":[{"type":"text","text":"We introduce a "},{"type":"text","text":"PaymentKit","marks":[{"type":"code"}]},{"type":"text","text":" interface that can produce every product needed to handle payments. Each provider gets its own implementation – "},{"type":"text","text":"GlobalPayKit","marks":[{"type":"code"}]},{"type":"text","text":" and "},{"type":"text","text":"PrzelewikKit","marks":[{"type":"code"}]},{"type":"text","text":". The "},{"type":"text","text":"Checkout","marks":[{"type":"code"}]},{"type":"text","text":" class accepts a single kit and takes all objects from it, so mixing families becomes impossible by the very shape of the code."}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"classDiagram\n  class PaymentKit {\n    <<interface>>\n    +createCharger() Charger\n    +createVerifier() WebhookVerifier\n  }\n  class Charger {\n    <<interface>>\n    +charge(amountCents) string\n  }\n  class WebhookVerifier {\n    <<interface>>\n    +verify(signature) bool\n  }\n  class Checkout {\n    +pay(amountCents) string\n    +onWebhook(signature) bool\n  }\n  PaymentKit <|.. GlobalPayKit\n  PaymentKit <|.. PrzelewikKit\n  Charger <|.. GlobalPayCharger\n  Charger <|.. PrzelewikCharger\n  WebhookVerifier <|.. GlobalPayVerifier\n  WebhookVerifier <|.. PrzelewikVerifier\n  GlobalPayKit ..> GlobalPayCharger : creates\n  GlobalPayKit ..> GlobalPayVerifier : creates\n  PrzelewikKit ..> PrzelewikCharger : creates\n  PrzelewikKit ..> PrzelewikVerifier : creates\n  Checkout --> PaymentKit","caption":"Abstract Factory: payment provider kits"}},{"type":"columns","attrs":{"layout":"1-1","valign":"center"},"content":[{"type":"column","content":[{"type":"paragraph","content":[{"type":"text","text":"A helpful picture: "},{"type":"text","text":"a family is a row, a kind of product is a column","marks":[{"type":"bold"}]},{"type":"text","text":". A concrete factory is responsible for a whole row. A new family (say, a mobile payments provider) is a new row – you add one factory class and its products without touching the client. A new kind of product (say, refunds) is a new column – and that gets expensive, because the interface and every factory change."}]}]},{"type":"column","content":[{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Family \\ product"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Charger","marks":[{"type":"code"}]}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"WebhookVerifier","marks":[{"type":"code"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"GlobalPayKit","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"ch_…","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"gp=","marks":[{"type":"code"}]},{"type":"text","text":" signature"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"PrzelewikKit","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"PRZ-…-PLN","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"prz=","marks":[{"type":"code"}]},{"type":"text","text":" signature"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"new family","marks":[{"type":"italic"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"+ 1 class"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"+ 1 class"}]}]}]}]}]}]},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Role"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"In the example"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Responsibility"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Abstract factory"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"PaymentKit","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"declares methods that create each kind of product"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Concrete factory"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"GlobalPayKit","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"PrzelewikKit","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"creates the products of one family"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Abstract product"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Charger","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"WebhookVerifier","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"interfaces the client works with"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Concrete product"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"GlobalPayCharger","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"PrefixVerifier(\"gp=\")","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"family-specific implementations"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Client"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Checkout","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"uses abstractions only; receives the factory from outside"}]}]}]}]},{"type":"heading","attrs":{"level":2,"id":"implementation-in-five-languages"},"content":[{"type":"text","text":"Implementation in five languages"}]},{"type":"paragraph","content":[{"type":"text","text":"We simplify signature verification to a prefix check – real providers use HMAC signatures, but that is not the point here. Look at the program's output: the Przelewik kit rejects a GlobalPay-style signature. That is exactly the mistake you can no longer make by mixing families accidentally."}]},{"type":"codeGroup","attrs":{"title":"IPaymentKit"},"content":[{"type":"codeBlock","attrs":{"language":"csharp","filename":"Payments.cs"},"content":[{"type":"text","text":"foreach (IPaymentKit kit in new IPaymentKit[] { new GlobalPayKit(), new PrzelewikKit() })\n{\n    var checkout = new Checkout(kit);\n    Console.WriteLine($\"{checkout.Pay(4990)} | gp=abc valid: {checkout.OnWebhook(\"gp=abc\")}\");\n}\n\npublic interface ICharger { string Charge(long amountCents); }\npublic interface IWebhookVerifier { bool Verify(string signature); }\n\n// Abstract factory: one object, one consistent family of products.\npublic interface IPaymentKit\n{\n    ICharger CreateCharger();\n    IWebhookVerifier CreateVerifier();\n}\n\npublic sealed class GlobalPayKit : IPaymentKit\n{\n    public ICharger CreateCharger() => new GlobalPayCharger();\n    public IWebhookVerifier CreateVerifier() => new PrefixVerifier(\"gp=\");\n}\n\npublic sealed class PrzelewikKit : IPaymentKit\n{\n    public ICharger CreateCharger() => new PrzelewikCharger();\n    public IWebhookVerifier CreateVerifier() => new PrefixVerifier(\"prz=\");\n}\n\ninternal sealed class GlobalPayCharger : ICharger\n{\n    public string Charge(long amountCents) => $\"ch_{amountCents}\";\n}\n\ninternal sealed class PrzelewikCharger : ICharger\n{\n    public string Charge(long amountCents) => $\"PRZ-{amountCents}-PLN\";\n}\n\n// Real providers verify HMAC signatures; a prefix check keeps the example short.\ninternal sealed record PrefixVerifier(string Prefix) : IWebhookVerifier\n{\n    public bool Verify(string signature) => signature.StartsWith(Prefix, StringComparison.Ordinal);\n}\n\n// The client sees only abstractions; both products come from the same kit, so they always match.\npublic sealed class Checkout(IPaymentKit kit)\n{\n    private readonly ICharger _charger = kit.CreateCharger();\n    private readonly IWebhookVerifier _verifier = kit.CreateVerifier();\n\n    public string Pay(long amountCents) => _charger.Charge(amountCents);\n    public bool OnWebhook(string signature) => _verifier.Verify(signature);\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"payments.ts"},"content":[{"type":"text","text":"interface Charger {\n  charge(amountCents: number): string;\n}\ninterface WebhookVerifier {\n  verify(signature: string): boolean;\n}\n\n// Abstract factory: one object, one consistent family of products.\ninterface PaymentKit {\n  createCharger(): Charger;\n  createVerifier(): WebhookVerifier;\n}\n\n// Real providers verify HMAC signatures; a prefix check keeps the example short.\nconst globalPay: PaymentKit = {\n  createCharger: () => ({ charge: (cents) => `ch_${cents}` }),\n  createVerifier: () => ({ verify: (sig) => sig.startsWith(\"gp=\") }),\n};\n\nconst przelewik: PaymentKit = {\n  createCharger: () => ({ charge: (cents) => `PRZ-${cents}-PLN` }),\n  createVerifier: () => ({ verify: (sig) => sig.startsWith(\"prz=\") }),\n};\n\nclass Checkout {\n  private readonly charger: Charger;\n  private readonly verifier: WebhookVerifier;\n\n  constructor(kit: PaymentKit) {\n    // Both products come from the same kit, so they always match.\n    this.charger = kit.createCharger();\n    this.verifier = kit.createVerifier();\n  }\n\n  pay(amountCents: number): string {\n    return this.charger.charge(amountCents);\n  }\n\n  onWebhook(signature: string): boolean {\n    return this.verifier.verify(signature);\n  }\n}\n\nfor (const kit of [globalPay, przelewik]) {\n  const checkout = new Checkout(kit);\n  console.log(checkout.pay(4990), \"| gp=abc valid:\", checkout.onWebhook(\"gp=abc\"));\n}"}]},{"type":"codeBlock","attrs":{"language":"java","filename":"Payments.java"},"content":[{"type":"text","text":"import java.util.List;\n\ninterface Charger { String charge(long amountCents); }\ninterface WebhookVerifier { boolean verify(String signature); }\n\n// Abstract factory: one object, one consistent family of products.\ninterface PaymentKit {\n    Charger createCharger();\n    WebhookVerifier createVerifier();\n}\n\n// Real providers verify HMAC signatures; a prefix check keeps the example short.\nfinal class GlobalPayKit implements PaymentKit {\n    public Charger createCharger() { return cents -> \"ch_\" + cents; }\n    public WebhookVerifier createVerifier() { return sig -> sig.startsWith(\"gp=\"); }\n}\n\nfinal class PrzelewikKit implements PaymentKit {\n    public Charger createCharger() { return cents -> \"PRZ-\" + cents + \"-PLN\"; }\n    public WebhookVerifier createVerifier() { return sig -> sig.startsWith(\"prz=\"); }\n}\n\nfinal class Checkout {\n    private final Charger charger;\n    private final WebhookVerifier verifier;\n\n    Checkout(PaymentKit kit) {\n        // Both products come from the same kit, so they always match.\n        this.charger = kit.createCharger();\n        this.verifier = kit.createVerifier();\n    }\n\n    String pay(long amountCents) { return charger.charge(amountCents); }\n    boolean onWebhook(String signature) { return verifier.verify(signature); }\n}\n\npublic class Payments {\n    public static void main(String[] args) {\n        List<PaymentKit> kits = List.of(new GlobalPayKit(), new PrzelewikKit());\n        for (PaymentKit kit : kits) {\n            Checkout checkout = new Checkout(kit);\n            System.out.println(checkout.pay(4990) + \" | gp=abc valid: \" + checkout.onWebhook(\"gp=abc\"));\n        }\n    }\n}"}]},{"type":"codeBlock","attrs":{"language":"go","filename":"payments.go"},"content":[{"type":"text","text":"package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n)\n\ntype Charger interface{ Charge(amountCents int64) string }\ntype WebhookVerifier interface{ Verify(signature string) bool }\n\n// PaymentKit is the abstract factory: one value, one consistent family of products.\ntype PaymentKit interface {\n\tNewCharger() Charger\n\tNewVerifier() WebhookVerifier\n}\n\n// Real providers verify HMAC signatures; a prefix check keeps the example short.\ntype prefixVerifier struct{ prefix string }\n\nfunc (v prefixVerifier) Verify(sig string) bool { return strings.HasPrefix(sig, v.prefix) }\n\ntype globalPayCharger struct{}\n\nfunc (globalPayCharger) Charge(c int64) string { return fmt.Sprintf(\"ch_%d\", c) }\n\ntype GlobalPayKit struct{}\n\nfunc (GlobalPayKit) NewCharger() Charger          { return globalPayCharger{} }\nfunc (GlobalPayKit) NewVerifier() WebhookVerifier { return prefixVerifier{\"gp=\"} }\n\ntype przelewikCharger struct{}\n\nfunc (przelewikCharger) Charge(c int64) string { return fmt.Sprintf(\"PRZ-%d-PLN\", c) }\n\ntype PrzelewikKit struct{}\n\nfunc (PrzelewikKit) NewCharger() Charger          { return przelewikCharger{} }\nfunc (PrzelewikKit) NewVerifier() WebhookVerifier { return prefixVerifier{\"prz=\"} }\n\ntype Checkout struct {\n\tcharger  Charger\n\tverifier WebhookVerifier\n}\n\n// NewCheckout takes both products from the same kit, so they always match.\nfunc NewCheckout(kit PaymentKit) Checkout {\n\treturn Checkout{charger: kit.NewCharger(), verifier: kit.NewVerifier()}\n}\n\nfunc main() {\n\tfor _, kit := range []PaymentKit{GlobalPayKit{}, PrzelewikKit{}} {\n\t\tc := NewCheckout(kit)\n\t\tfmt.Println(c.charger.Charge(4990), \"| gp=abc valid:\", c.verifier.Verify(\"gp=abc\"))\n\t}\n}"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"payments.py"},"content":[{"type":"text","text":"from dataclasses import dataclass\nfrom typing import Protocol\n\n\nclass Charger(Protocol):\n    def charge(self, amount_cents: int) -> str: ...\n\n\nclass WebhookVerifier(Protocol):\n    def verify(self, signature: str) -> bool: ...\n\n\nclass PaymentKit(Protocol):\n    \"\"\"Abstract factory: one object, one consistent family of products.\"\"\"\n\n    def create_charger(self) -> Charger: ...\n    def create_verifier(self) -> WebhookVerifier: ...\n\n\n@dataclass(frozen=True)\nclass PrefixVerifier:  # real providers check HMAC signatures\n    prefix: str\n\n    def verify(self, signature: str) -> bool:\n        return signature.startswith(self.prefix)\n\n\n@dataclass(frozen=True)\nclass TemplateCharger:  # each provider formats payment ids its own way\n    template: str\n\n    def charge(self, amount_cents: int) -> str:\n        return self.template.format(amount_cents)\n\n\nclass GlobalPayKit:\n    def create_charger(self) -> Charger:\n        return TemplateCharger(\"ch_{}\")\n\n    def create_verifier(self) -> WebhookVerifier:\n        return PrefixVerifier(\"gp=\")\n\n\nclass PrzelewikKit:\n    def create_charger(self) -> Charger:\n        return TemplateCharger(\"PRZ-{}-PLN\")\n\n    def create_verifier(self) -> WebhookVerifier:\n        return PrefixVerifier(\"prz=\")\n\n\nclass Checkout:\n    def __init__(self, kit: PaymentKit) -> None:\n        # Both products come from the same kit, so they always match.\n        self.charger = kit.create_charger()\n        self.verifier = kit.create_verifier()\n\n\nif __name__ == \"__main__\":\n    for kit in (GlobalPayKit(), PrzelewikKit()):\n        checkout = Checkout(kit)\n        print(checkout.charger.charge(4990), \"| gp=abc valid:\", checkout.verifier.verify(\"gp=abc\"))"}]}]}]},"toc":[{"id":"the-problem-payment-from-one-provider-webhook-from-another","text":"The problem: payment from one provider, webhook from another","level":2,"locked":false},{"id":"the-solution-one-object-for-the-whole-family","text":"The solution: one object for the whole family","level":2,"locked":false},{"id":"implementation-in-five-languages","text":"Implementation in five languages","level":2,"locked":false},{"id":"step-by-step","text":"Step by step","level":2,"locked":true},{"id":"when-to-use-it-and-when-not-to","text":"When to use it and when not to","level":2,"locked":true},{"id":"related-patterns","text":"Related patterns","level":2,"locked":true},{"id":"in-practice","text":"In practice","level":2,"locked":true},{"id":"quick-check","text":"Quick check","level":2,"locked":true},{"id":"summary","text":"Summary","level":2,"locked":true}],"locked":true,"paywall":null,"previewRatio":0.3,"totalBlocks":34,"visibleBlocks":14,"resources":[{"id":"6b0857a53c96f2d34d0b321e","type":"video","provider":"youtube","url":"https://www.youtube.com/watch?v=v-GiuMmsXj4","embedUrl":"https://www.youtube-nocookie.com/embed/v-GiuMmsXj4","title":"Abstract Factory Pattern – Design Patterns (ep 5)","description":"","author":"Christopher Okhravi","thumbnailUrl":"https://i.ytimg.com/vi/v-GiuMmsXj4/hqdefault.jpg","durationSec":null,"lang":"en","topics":["abstract-factory"],"techs":["general"],"tags":[],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"seed","publishedAt":null,"popularity":0,"verifiedAt":"2026-11-26T00:00:00.000Z","curated":true,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:37.727Z","updatedAt":"2026-11-26T16:00:37.727Z"},{"id":"6b0857c33c96f2d34d0b4658","type":"book","provider":"openlibrary","url":"https://openlibrary.org/works/OL6030812W","embedUrl":null,"title":"Design Patterns: Elements of Reusable Object-Oriented Software","description":"","author":"Erich Gamma, John Vlissides, Richard Helm, Ralph Johnson","thumbnailUrl":"https://covers.openlibrary.org/b/id/6601119-L.jpg","durationSec":null,"lang":"en","topics":["factory-method","abstract-factory","builder","prototype","singleton","adapter","bridge","composite","decorator","facade","flyweight","proxy","chain-of-responsibility","command","iterator","mediator","memento","observer","state","strategy","template-method","visitor"],"techs":["general"],"tags":["book","design-patterns"],"price":"paid","featured":false,"featuredOrder":0,"packageName":null,"source":"openlibrary","publishedAt":"1995-01-01T00:00:00.000Z","popularity":71,"verifiedAt":"2026-11-26T11:00:08.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:04.995Z","updatedAt":"2026-11-26T16:01:04.995Z"},{"id":"6b0857be3c96f2d34d0b41e3","type":"article","provider":"web","url":"https://refactoring.guru/design-patterns/abstract-factory","embedUrl":null,"title":"Abstract Factory","description":"Abstract Factory is a creational design pattern that lets you produce families of related objects without specifying their concrete classes.","author":"Refactoring.Guru","thumbnailUrl":"https://refactoring.guru/images/refactoring/social/facebook-share-preview.png?id=dbf9e98269595be86eb668f365be6868","durationSec":null,"lang":"en","topics":["abstract-factory"],"techs":["general"],"tags":["design-patterns"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":75,"verifiedAt":"2026-11-26T11:26:00.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857b13c96f2d34d0b33a1","type":"repo","provider":"github","url":"https://github.com/iluwatar/java-design-patterns","embedUrl":null,"title":"iluwatar/java-design-patterns","description":"Design patterns implemented in Java","author":"iluwatar","thumbnailUrl":"https://opengraph.githubassets.com/1/iluwatar/java-design-patterns","durationSec":null,"lang":"en","topics":[],"techs":["java"],"tags":["awesome-list","design-patterns","hacktoberfest","java","principles","snippets","snippets-collection","snippets-library"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"github","publishedAt":"2014-08-09T16:45:18.000Z","popularity":96,"verifiedAt":"2026-11-26T10:57:25.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:49.541Z","updatedAt":"2026-11-26T16:00:49.541Z"}],"challenges":[{"id":"6b0857af5a2625e44ecaad0a","slug":"notification-factory","title":"Notification factory","summary":"Implement Factory Method: every notification service decides which channel (e-mail, SMS, push) it creates.","servedLang":"en","availableLangs":["pl","en"],"kind":"code","category":null,"status":"published","difficulty":"easy","topics":["factory-method"],"techs":["typescript","javascript"],"tags":["factory-method","notifications","creational"],"languages":["typescript","javascript"],"questionCount":null,"xp":10,"stats":{"attempts":1,"solves":1,"solutions":1,"comments":0},"solveRate":100,"publishedAt":"2026-11-26T16:00:47.675Z"}],"attachments":[],"hasCode":true,"repoUrl":null,"series":[{"slug":"gof-creational","title":"GoF creational patterns","items":[{"slug":"factory-method","title":"Factory Method – let the subclass decide what gets created","current":false},{"slug":"abstract-factory","title":"Abstract Factory – whole families of objects that fit together","current":true},{"slug":"builder","title":"Builder – complex objects step by step","current":false},{"slug":"prototype","title":"Prototype – a new object as a copy of a ready-made template","current":false},{"slug":"singleton","title":"Singleton – one instance, and the reasons to hand it to a DI container","current":false}]}],"prev":{"slug":"factory-method","title":"Factory Method – let the subclass decide what gets created"},"next":{"slug":"builder","title":"Builder – complex objects step by step"},"featured":false,"authorCard":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","headline":"Wzorce projektowe · Architektura · AI i LLM","community":false,"reputation":{"points":3900,"level":{"key":"mentor","label":"Mentor"}},"articles":68,"skills":[{"key":"typescript","title":"TypeScript","level":5,"levelLabel":"Authority","articles":63},{"key":"dotnet","title":".NET","level":5,"levelLabel":"Authority","articles":53},{"key":"python","title":"Python","level":5,"levelLabel":"Authority","articles":52},{"key":"java","title":"Java","level":5,"levelLabel":"Authority","articles":38}]}}