✨ ARCANUM RUNE DIFFICULTY: Apprentice Creational

The Oracle's Factory Method

Delegating the instantiation of specific mystical entities to the underlying resolvers.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Factory Method
ARCANUM SCHOOL: Conjuration // Resolvers
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
interface SummonedEntity {
  id: ID!
  planeOfOrigin: String!
}

type Demon implements SummonedEntity {
  id: ID!
  planeOfOrigin: String!
  horns: Int!
}

type Angel implements SummonedEntity {
  id: ID!
  planeOfOrigin: String!
  wingspan: Float!
}

type Mutation {
  # The Factory Method
  # The exact type of SummonedEntity is decided by the Oracle's internal logic
  performSummoning(ritualType: String!): SummonedEntity!
}

Through the Factory Method, the exact nature of the entity returned is obscured from the invoker. The client simply asks the Oracle to perform a summoning, and the Oracle’s hidden logic decides whether an Angel or a Demon manifests.

Runic Tags: #graphql #interface #mutation #creational #factory-method