$30 off During Our Annual Pro Sale. View Details »

Business Archetype Patterns: Archetype Party

Michal L
November 20, 2023

Business Archetype Patterns: Archetype Party

Introduction into the business archetype patterns and description of the Party and Party Relationship archetype patterns. Practical example of archetype Party implementation in Ruby on Rails app.

Michal L

November 20, 2023
Tweet

More Decks by Michal L

Other Decks in Programming

Transcript

  1. Revealing Party
    archetype pattern
    HOW TO PARTY

    AND MAKE
    RELATIONSHIPS

    View Slide

  2. A primordial thing or circumstance
    that recurs consistently and is
    thought to be a universal concept or
    situation
    Archetype

    View Slide

  3. Hero archetype

    View Slide

  4. BUSINESS


    ARCHETYPE

    View Slide

  5. Business archetype
    UNIVERSAL
    PERSVASIVE
    DEEP HISTORY
    SELF
    -
    EVIDENT

    View Slide

  6. BUSINESS


    ARCHETYPE


    PATTERN

    View Slide

  7. BUSINESS


    ARCHETYPE


    PATTERN
    PARTY INVENTORY
    COMPANY PRODUCT
    ORDER
    RULE

    View Slide

  8. HOW TO FIND


    ARCHETYPE PATTERNS
    Literature Experts
    Business domain

    View Slide

  9. PLEOMORPHISM
    Adaptation of an archetype
    pattern to a specific business
    context by a modification of its
    form such that its essential
    semantics remain unchanged

    View Slide

  10. Adaptation of an archetype
    pattern to a specific business
    context by a modification of its
    form such that its essential
    semantics remain unchanged
    PLEOMORPHISM

    View Slide

  11. How to apply archetype patterns?
    0. Know archetype patterns


    1. Understand stakeholder requirements


    2. Select pleomorph


    3. Perform translation/mapping


    4. Extend archetype pattern for domain

    View Slide

  12. ARCHETYPE

    PARTY


    👪

    View Slide

  13. ARCHETYPE


    PARTY
    Best image I coud find..

    View Slide

  14. Identifable, addresable unit that
    may have a legal status and that
    normally has autonomous control
    over its actions
    PARTY 👪

    View Slide

  15. <>
    Party
    <> description: String
    getIdentifier(): PartyIdentifier
    <> getRegisteredIdentifiers(): RegisteredIdentifier[]
    getName(): String
    getAddresses(): Address[]
    <> getRoles(): PartyRole[]
    <> getPreferences(): Preference[]
    1..* 0..* << archetype >>
    Address
    << archetype >>
    Person
    << archetype >>
    PersonName
    << archetype >>
    PartyIdentifier
    << archetype >>
    UniqueIdentifier
    << archetype >>
    Preference
    << archetype >>
    RegisteredIdentifier
    1 1
    0..*
    1
    personName
    <>
    otherPersonNames
    << archetype >>
    Organization
    << archetype >>
    OrganizationName
    1 1
    0..*
    1
    organizationName <>
    otherOrganizationNames
    1
    1
    1
    <>
    1
    0..*
    0..*
    <>
    ARCHETYPE


    PARTY

    View Slide

  16. Person Organisation
    ARCHETYPE PARTY

    View Slide

  17. Person Organisation
    Identifier
    ARCHETYPE PARTY

    View Slide

  18. Person Organisation
    Identifier Registered Identifier
    ARCHETYPE PARTY

    View Slide

  19. Person Organisation
    Identifier Registered Identifier
    ARCHETYPE PARTY
    Address Name Preferences

    View Slide

  20. ARCHETYPE

    PARTY


    RELATIONSHIP


    👯

    View Slide

  21. Family Relationship


    Parent Child


    Parent Son


    Father Son
    Family
    Level of abstraction
    Symmetry

    View Slide

  22. ARCHETYPE

    PARTY RELATIONSHIP
    Party Role
    Party
    Relationship

    View Slide

  23. ARCHETYPE


    PARTY RELATIONSHIP
    <>
    PartyRole
    <> name: String
    <> description: String
    getParty(): Party
    getIdentifier(): PartyRoleIdentifier
    <> getName(): String
    <> getDescription(): String
    <> getRoleType(): PartyRoleType
    <> getResponsibility( name )
    <> assignResponsibility( responsibility: Responsibility)
    <> removeResponsibility( name )
    << archetype >>
    Party
    0..*
    client
    0..1
    0..*
    1
    <>
    UniqueIdentifier
    getIdentifier(): String
    <>
    PartyRoleIdentifier
    identifier: String
    <>
    PartyRelationship
    <> name: String
    <> description: String
    getClientPartyRole(): PartyRole
    getSupplierPartyRole(): PartyRole
    <> getDescription(): String
    <> getRelationshipType(): PartyRelationshipType
    <> getName(): String
    supplier
    0..*
    1
    1
    1

    View Slide

  24. SYMMETRY

    View Slide

  25. Symmetrical relationship
    << archetype >>
    PartyRole
    << archetype >>
    Party
    << archetype >>
    PartyRelationship
    1
    0..*
    0..*
    1
    1
    1

    View Slide

  26. Symmetrical relationship
    Party
    Party
    Relationship
    Party
    Alice
    Sister-Sister
    Erica
    Sister Party Role

    View Slide

  27. Asymmetrical relationship
    << archetype >>
    Party
    << archetype >>
    PartyRelationship
    << archetype >>
    PartyRole
    0..*
    1
    1
    1
    0..*
    0..*
    client
    supplier

    View Slide

  28. Party
    Party Role
    Party
    Relationship
    Party Role
    Party
    Anakin
    Father
    Father
    -
    Son
    Son
    Luke
    Asymmetrical


    relationship

    View Slide

  29. Party Role Type
    ARCHETYPE

    PARTY RELATIONSHIP
    Party Role
    Party
    Relationship
    Party
    Relationship
    Type

    View Slide

  30. <>
    PartyRole
    <> name: String
    <> description: String
    getParty(): Party
    getIdentifier(): PartyRoleIdentifier
    <> getName(): String
    <> getDescription(): String
    <> getRoleType(): PartyRoleType
    ...
    << archetype >>
    Party
    0..*
    0..*
    1
    <>
    PartyRoleType
    name: String
    description: String
    canPlayRole (party: Party): Boolean
    <> canPlayRole (party: Party, context: RuleContext): Boolean
    <> getConstraints(): PartyRoleConstraint[]
    ...
    supplier
    0..* 1
    <>
    PartyRelationship
    <> name: String
    <> description: String
    getClientPartyRole(): PartyRole
    getSupplierPartyRole(): PartyRole
    <> getName(): String
    <> getDescription(): String
    <> getRelationshipType(): PartyRelationshipType
    <>
    PartyRelationshipType
    name: String
    description: String
    canFormRelationship (client: PartyRole, supplier: PartyRole): Boolean
    <> canFormRelationship (client: PartyRole, supplier: PartyRole, context: RuleContext): Boolean
    <> getConstraints(): PartyRelationshipConstraint
    client 1 1
    0..*
    roleType
    <>
    0..* 1
    relationshipType
    <>
    << archetype >>
    PartyRoleConstraint
    <>
    1
    1..*
    validTypesOfParty
    << archetype >>
    PartyRelationshipConstraint
    1..*
    1
    <>
    validRolePairs

    View Slide

  31. PARTY MANAGEMENT
    Which things can be connected together
    and which things can’t?

    View Slide

  32. Party Role Type
    ARCHETYPE

    PARTY RELATIONSHIP
    Party Role
    Party
    Relationship
    Party
    Relationship
    Type
    Party Role
    Constraint
    Party
    Relationship
    Constraint

    View Slide

  33. << archetype >>
    Party
    0..*
    0..*
    1
    <>
    PartyRoleType
    canPlayRole (party: Party): Boolean
    <> canPlayRole (party: Party, context: RuleContext): Boolean
    <> getConstraints(): PartyRoleConstraint[]
    ...
    supplier
    0..* 1
    <>
    PartyRelationshipType
    canFormRelationship (client: PartyRole, supplier: PartyRole): Boolean
    <> canFormRelationship (client: PartyRole, supplier: PartyRole,
    context: RuleContext): Boolean
    <> getConstraints(): PartyRelationshipConstraint
    client
    1 1
    0..*
    roleType
    <>
    0..* 1
    relationshipType
    <>
    <>
    1 1..*
    validTypesOfParty
    1..*
    1
    <>
    validRolePairs
    << archetype >>
    PartyRole
    << archetype >>
    PartyRelationship
    << archetype >>
    RuleSet
    <>
    PartyRoleConstraint
    typeOfParty: String
    canPlayRole (party: Party): Boolean
    <>
    PartyRelationshipConstraint
    clientRoleName: String
    supplierRoleName: String
    canFormRelationship (partyRoleA: PartyRole,
    partyRoleB: PartyRole): Boolean
    <>
    <>
    1
    1
    1
    1
    requirementsForRole
    requirementsForRelationship

    View Slide

  34. View Slide

  35. Scrum team example
    https://github.com/maikhel/business-archetypes

    View Slide

  36. Scrum team example
    People
    first_name: String
    last_name: String
    Roles
    name: String
    description: String
    Projects
    name: String
    start_at: DateTime
    end_at: DateTime
    RoleInProjects
    FK person_id
    FK role_id
    FK project_id
    Supervisions
    FK subordinate_id
    FK supervisor_id
    FK project_id

    View Slide

  37. Scrum team example
    code
    https://github.com/maikhel/business-archetypes/tree/v1.0-no-archetypes

    View Slide

  38. Scrum team example
    https://github.com/maikhel/business-archetypes/tree/v1.0-no-archetypes

    View Slide

  39. Scrum team example

    View Slide

  40. Scrum team example

    View Slide

  41. Scrum team example
    People
    first_name: String
    last_name: String
    Roles
    name: String
    description: String
    Projects
    name: String
    start_at: DateTime
    end_at: DateTime
    RoleInProjects
    FK person_id
    FK role_id
    FK project_id
    Supervisions
    FK subordinate_id
    FK supervisor_id
    FK project_id

    View Slide

  42. Scrum team example

    View Slide

  43. Scrum team example
    People
    first_name: String
    last_name: String
    Roles
    FK party_id
    description: String
    name: String
    Projects
    name: String
    start_at: DateTime
    end_at: DateTime
    Relationships
    FK supplier_role_id
    FK client_role_id
    name: String
    description: String

    View Slide

  44. Scrum team example
    https://github.com/maikhel/business-archetypes/tree/v1.1-relationship-archetype

    View Slide

  45. Scrum team example
    https://github.com/maikhel/business-archetypes/tree/v1.1-relationship-archetype

    View Slide

  46. Scrum team example

    View Slide

  47. Scrum team example

    View Slide

  48. Scrum team example

    View Slide

  49. Was it worth it?
    github.com/maikhel/business-archetypes

    View Slide

  50. Party Role Type
    ARCHETYPE

    PARTY RELATIONSHIP
    Party Role
    Party
    Relationship
    Party
    Relationship
    Type
    Party Role
    Constraint
    Party
    Relationship
    Constraint
    Responsibilities Capabilities

    View Slide

  51. Party Role Type
    ARCHETYPE

    PARTY RELATIONSHIP
    Party Role
    Party
    Relationship
    Party
    Relationship
    Type
    Party Role
    Constraint
    Party
    Relationship
    Constraint
    Responsibilities Capabilities
    Party Summary

    View Slide

  52. Use only
    elements


    you need

    View Slide

  53. Recipe for a great party 👪
    1. Identify the types of Parties in the system


    2. List different types of relationships between them - create Party Relationships


    3. Check that party relationships meet identifable business needs


    4. Work out what roles different types of parties play in Party Relationships
    -
    Party
    Roles


    5. Formulate rules
    -
    Party Role Constraints, Party Relationships Constraints

    View Slide

  54. CREDITS
    Enterprise Patterns and MDA
    :
    Building Better Software with
    Archetype Patterns and UML


    Jim Arlow, Ila Neustadt
    https://www.amazon.pl/Enterprise-Patterns-MDA-Building-Archetype/dp/032111230X

    View Slide

  55. Thank you!

    View Slide

  56. MICHAŁ

    ŁĘCICKI
    [email protected] @mlecicki https://maikhel.github.io

    View Slide