{
  "code": null,
  "collection": "architecture",
  "href": "https://banes-lab.com/ontology#architecture-polymorphism",
  "id": "polymorphism",
  "kind": "mechanism",
  "layer": {
    "href": "https://banes-lab.com/ontology/schema#layer-structural-core",
    "json": "https://banes-lab.com/json/records/layer/structural-core",
    "label": "Structural Core",
    "markdown": "https://banes-lab.com/records/layer/structural-core.md",
    "ref": "layer:structural-core"
  },
  "name": "Polymorphism",
  "ref": "architecture:polymorphism",
  "relations": [
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-abstraction",
          "json": "https://banes-lab.com/json/records/architecture/abstraction",
          "label": "Abstraction",
          "markdown": "https://banes-lab.com/records/architecture/abstraction.md",
          "ref": "architecture:abstraction"
        },
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-substitutability",
          "json": "https://banes-lab.com/json/records/lexicon/substitutability",
          "label": "Substitutability",
          "markdown": "https://banes-lab.com/records/lexicon/substitutability.md",
          "ref": "lexicon:substitutability"
        }
      ],
      "relation": "requires"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-open-closed",
          "json": "https://banes-lab.com/json/records/architecture/open-closed",
          "label": "Open/Closed Principle (OCP)",
          "markdown": "https://banes-lab.com/records/architecture/open-closed.md",
          "ref": "architecture:open-closed"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-strategy-pattern",
          "json": "https://banes-lab.com/json/records/architecture/strategy-pattern",
          "label": "Strategy Pattern",
          "markdown": "https://banes-lab.com/records/architecture/strategy-pattern.md",
          "ref": "architecture:strategy-pattern"
        }
      ],
      "relation": "reinforces"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-dynamic-dispatch",
          "json": "https://banes-lab.com/json/records/architecture/dynamic-dispatch",
          "label": "Dynamic Dispatch",
          "markdown": "https://banes-lab.com/records/architecture/dynamic-dispatch.md",
          "ref": "architecture:dynamic-dispatch"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-interchangeability",
          "json": "https://banes-lab.com/json/records/architecture/interchangeability",
          "label": "Interchangeability",
          "markdown": "https://banes-lab.com/records/architecture/interchangeability.md",
          "ref": "architecture:interchangeability"
        }
      ],
      "relation": "enables"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-type-switching",
          "json": "https://banes-lab.com/json/records/lexicon/type-switching",
          "label": "Type Switching",
          "markdown": "https://banes-lab.com/records/lexicon/type-switching.md",
          "ref": "lexicon:type-switching"
        }
      ],
      "relation": "conflicts-with"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-traceability",
          "json": "https://banes-lab.com/json/records/architecture/traceability",
          "label": "Traceability",
          "markdown": "https://banes-lab.com/records/architecture/traceability.md",
          "ref": "architecture:traceability"
        }
      ],
      "relation": "tensions-with"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/schema#tension-polymorphism-traceability",
          "json": "https://banes-lab.com/json/records/tension/polymorphism-traceability",
          "label": "Polymorphism / Traceability",
          "markdown": "https://banes-lab.com/records/tension/polymorphism-traceability.md",
          "ref": "tension:polymorphism-traceability"
        }
      ],
      "relation": "tensions"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-type-switching",
          "json": "https://banes-lab.com/json/records/lexicon/type-switching",
          "label": "Type Switching",
          "markdown": "https://banes-lab.com/records/lexicon/type-switching.md",
          "ref": "lexicon:type-switching"
        }
      ],
      "relation": "violated-by"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-replace-conditional-with-polymorphism",
          "json": "https://banes-lab.com/json/records/lexicon/replace-conditional-with-polymorphism",
          "label": "Replace Conditional with Polymorphism",
          "markdown": "https://banes-lab.com/records/lexicon/replace-conditional-with-polymorphism.md",
          "ref": "lexicon:replace-conditional-with-polymorphism"
        }
      ],
      "relation": "refactored-by"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/schema#vocabulary-severity-recommended",
          "json": "https://banes-lab.com/json/records/vocabulary/severity-recommended",
          "label": "recommended",
          "markdown": "https://banes-lab.com/records/vocabulary/severity-recommended.md",
          "ref": "vocabulary:severity-recommended"
        }
      ],
      "relation": "severity"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-category-solid-object-oriented-design",
          "json": "https://banes-lab.com/json/records/architecture-category/solid-object-oriented-design",
          "label": "SOLID / Object-Oriented Design",
          "markdown": "https://banes-lab.com/records/architecture-category/solid-object-oriented-design.md",
          "ref": "architecture-category:solid-object-oriented-design"
        }
      ],
      "relation": "category"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-dynamic-binding",
          "json": "https://banes-lab.com/json/records/architecture/dynamic-binding",
          "label": "Dynamic Binding",
          "markdown": "https://banes-lab.com/records/architecture/dynamic-binding.md",
          "ref": "architecture:dynamic-binding"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-liskov-substitution",
          "json": "https://banes-lab.com/json/records/architecture/liskov-substitution",
          "label": "Liskov Substitution Principle",
          "markdown": "https://banes-lab.com/records/architecture/liskov-substitution.md",
          "ref": "architecture:liskov-substitution"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-state-pattern",
          "json": "https://banes-lab.com/json/records/architecture/state-pattern",
          "label": "State Pattern",
          "markdown": "https://banes-lab.com/records/architecture/state-pattern.md",
          "ref": "architecture:state-pattern"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-null-object-pattern",
          "json": "https://banes-lab.com/json/records/architecture/null-object-pattern",
          "label": "Null Object Pattern",
          "markdown": "https://banes-lab.com/records/architecture/null-object-pattern.md",
          "ref": "architecture:null-object-pattern"
        }
      ],
      "relation": "reinforced-by"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-category-runtime-discovery-dynamic-binding",
          "json": "https://banes-lab.com/json/ontology/principles/architecture-category-runtime-discovery-dynamic-binding",
          "label": "Runtime Discovery / Dynamic Binding",
          "markdown": "https://banes-lab.com/ontology/principles/architecture-category-runtime-discovery-dynamic-binding.md",
          "ref": "chapter:/ontology#architecture-category-runtime-discovery-dynamic-binding"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-category-core-modular-design",
          "json": "https://banes-lab.com/json/ontology/principles/architecture-category-core-modular-design",
          "label": "Core Modular Design",
          "markdown": "https://banes-lab.com/ontology/principles/architecture-category-core-modular-design.md",
          "ref": "chapter:/ontology#architecture-category-core-modular-design"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-category-solid-object-oriented-design",
          "json": "https://banes-lab.com/json/ontology/principles/architecture-category-solid-object-oriented-design",
          "label": "SOLID / Object-Oriented Design",
          "markdown": "https://banes-lab.com/ontology/principles/architecture-category-solid-object-oriented-design.md",
          "ref": "chapter:/ontology#architecture-category-solid-object-oriented-design"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-category-observability-auditability-traceability",
          "json": "https://banes-lab.com/json/ontology/principles/architecture-category-observability-auditability-traceability",
          "label": "Observability / Auditability / Traceability",
          "markdown": "https://banes-lab.com/ontology/principles/architecture-category-observability-auditability-traceability.md",
          "ref": "chapter:/ontology#architecture-category-observability-auditability-traceability"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-category-behavioral-patterns",
          "json": "https://banes-lab.com/json/ontology/principles/architecture-category-behavioral-patterns",
          "label": "Behavioral Patterns",
          "markdown": "https://banes-lab.com/ontology/principles/architecture-category-behavioral-patterns.md",
          "ref": "chapter:/ontology#architecture-category-behavioral-patterns"
        },
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-category-quality-attributes",
          "json": "https://banes-lab.com/json/ontology/lexicon/lexicon-category-quality-attributes",
          "label": "Quality Attributes",
          "markdown": "https://banes-lab.com/ontology/lexicon/lexicon-category-quality-attributes.md",
          "ref": "chapter:/ontology/lexicon#lexicon-category-quality-attributes"
        },
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-category-runtime-discovery-dynamic-binding",
          "json": "https://banes-lab.com/json/ontology/lexicon/lexicon-category-runtime-discovery-dynamic-binding",
          "label": "Runtime Discovery / Dynamic Binding",
          "markdown": "https://banes-lab.com/ontology/lexicon/lexicon-category-runtime-discovery-dynamic-binding.md",
          "ref": "chapter:/ontology/lexicon#lexicon-category-runtime-discovery-dynamic-binding"
        },
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-category-solid-object-oriented-design",
          "json": "https://banes-lab.com/json/ontology/lexicon/lexicon-category-solid-object-oriented-design",
          "label": "SOLID / Object-Oriented Design",
          "markdown": "https://banes-lab.com/ontology/lexicon/lexicon-category-solid-object-oriented-design.md",
          "ref": "chapter:/ontology/lexicon#lexicon-category-solid-object-oriented-design"
        },
        {
          "href": "https://banes-lab.com/ontology/schema#the-vocabulary-severity",
          "json": "https://banes-lab.com/json/ontology/schema/the-vocabulary-severity",
          "label": "Severity levels",
          "markdown": "https://banes-lab.com/ontology/schema/the-vocabulary-severity.md",
          "ref": "chapter:/ontology/schema#the-vocabulary-severity"
        },
        {
          "href": "https://banes-lab.com/ontology/schema#the-resolutions",
          "json": "https://banes-lab.com/json/ontology/schema/the-resolutions",
          "label": "The resolutions",
          "markdown": "https://banes-lab.com/ontology/schema/the-resolutions.md",
          "ref": "chapter:/ontology/schema#the-resolutions"
        }
      ],
      "relation": "linked-from"
    }
  ],
  "summary": "A mechanism that lets one interface have several implementations, with the implementation chosen by the object that receives the call.",
  "siblings": {
    "next": {
      "href": "https://banes-lab.com/ontology#architecture-event-driven-architecture",
      "json": "https://banes-lab.com/json/records/architecture/event-driven-architecture",
      "label": "Event-Driven Architecture",
      "markdown": "https://banes-lab.com/records/architecture/event-driven-architecture.md",
      "ref": "architecture:event-driven-architecture"
    },
    "previous": {
      "href": "https://banes-lab.com/ontology#architecture-liskov-substitution",
      "json": "https://banes-lab.com/json/records/architecture/liskov-substitution",
      "label": "Liskov Substitution Principle (LSP)",
      "markdown": "https://banes-lab.com/records/architecture/liskov-substitution.md",
      "ref": "architecture:liskov-substitution"
    }
  },
  "up": {
    "href": null,
    "json": "https://banes-lab.com/json/api/records/architecture",
    "label": "Architecture principles",
    "markdown": "https://banes-lab.com/api/records/architecture.md",
    "ref": "api:records/architecture"
  },
  "aliases": [],
  "exemplar": {
    "after": "interface FooRenderer { render(foo: Foo): string; }\nclass TextFooRenderer implements FooRenderer { render(foo: Foo) { return foo.name; } }\nclass JsonFooRenderer implements FooRenderer { render(foo: Foo) { return JSON.stringify(foo); } }\nfunction renderFoo(renderer: FooRenderer, foo: Foo) { return renderer.render(foo); }",
    "before": "function renderFoo(kind: string, foo: Foo) {\n  if (kind === \"text\") return foo.name;\n  if (kind === \"json\") return JSON.stringify(foo);\n  throw new Error(\"unknown renderer\");\n}",
    "lang": "ts",
    "medium": "code"
  },
  "formedBy": null,
  "scope": [
    "class",
    "interface",
    "runtime"
  ],
  "severity": "recommended"
}
