Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Business Archetypes patterns with Rails

Michal L
January 31, 2024

Business Archetypes patterns with Rails

An introduction into business archetypes patterns: a great pill of knowledge on how to implement universal concepts occurring in business and business software systems. A complex theory explained with various Rails examples and practical recipes

Michal L

January 31, 2024
Tweet

More Decks by Michal L

Other Decks in Programming

Transcript

  1. How to help the feeling that somebody already solved your

    problems BUSINESS ARCHETYPES PATTERNS WITH RAILS
  2. 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
  3. A primordial thing or circumstance that recurs consistently and is

    thought to be a universal concept or situation Archetype
  4. PLEOMORPHISM Adaptation of an archetype pattern to a specific business

    context by a modification of its form such that its essential semantics remain unchanged generated by DALL·E 3
  5. 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
  6. Identifable, addresable unit that may have a legal status and

    that normally has autonomous control over its actions PARTY
  7. <<archetype>> Party <<o>> description: String getIdentifier(): PartyIdentifier <<o>> getRegisteredIdentifiers(): RegisteredIdentifier[]

    getName(): String getAddresses(): Address[] <<o>> getRoles(): PartyRole[] <<o>> getPreferences(): Preference[] 1..* 0..* << archetype >> Address << archetype >> Person << archetype >> PersonName << archetype >> PartyIdentifier << archetype >> UniqueIdentifier << archetype >> Preference << archetype >> RegisteredIdentifier 1 1 0..* 1 personName <<o>> otherPersonNames << archetype >> Organization << archetype >> OrganizationName 1 1 0..* 1 organizationName <<o>> otherOrganizationNames 1 1 1 <<o>> 1 0..* 0..* <<o>> ARCHETYPE PARTY
  8. Family Relationship Parent Child Parent Son Father Son Family Level

    of abstraction Symmetry generated by DALL·E 3
  9. Party Role Party Relationship Party Role Party Leia Sister Siblings

    Brother Luke Asymmetrical relationship Party
  10. ARCHETYPE PARTY RELATIONSHIP <<archetype>> PartyRole <<o>> name: String <<o>> description:

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

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

    Relationship Party Relationship Type Party Role Constraint Party Relationship Constraint
  13. Party Role Type ARCHETYPE 
 PARTY RELATIONSHIP Party Role Party

    Relationship Party Relationship Type Party Role Constraint Party Relationship Constraint Responsibilities Capabilities
  14. Party Role Type ARCHETYPE 
 PARTY RELATIONSHIP Party Role Party

    Relationship Party Relationship Type Party Role Constraint Party Relationship Constraint Responsibilities Capabilities Party Summary
  15. 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
  16. ARCHETYPE PARTY What relationships are worth to capture? At what

    level of abstraction? Who can be connected with whom? Questions you should ask yourself
  17. My insights Capture characteristic or just existence of relationship? ActiveRecord

    vs archetype approach Problems with searching Modeling Rules of relationships
  18. <<archetype>> ProductIdentifier productIdentifier: String getIdentifier(): String 0..* << archetype >>

    ProductInstance 1 1 1 << archetype >> Product Type <<archetype>> UniqueIdentifier getIdentifier(): String <<archetype>> SerialNumber serialNumber: String getIdentifier(): String 0..1 << o >> 1
  19. ARCHETYPE 
 PRODUCT Product Type Product Instance Product Batch Product

    Specification Product Catalog Catalog Entry Package Type Package Instance Package
  20. ARCHETYPE 
 PRODUCT Product Type Product Instance Product Batch Product

    Specification Product Catalog Catalog Entry Package Type Package Instance Package Product Relationship
  21. ARCHETYPE 
 PRODUCT Product Type Product Instance Product Batch Product

    Specification Product Catalog Catalog Entry Package Type Package Instance Package Pricing Product Relationship
  22. ARCHETYPE PRODUCT Questions you should ask yourself What is a

    good identifier for the product? Handling serial numbers Searching in product catalog Handling package specification Pricing
  23. My insights Optimize the system/models structure for proper product type

    Don’t confuse Products with Catalog Entries Have a separate model for Price
  24. MORE RESOURCES Enterprise Patterns and MDA : Building Better Software

    with Archetype Patterns and UML Jim Arlow, Ila Neustadt Analysis Patterns: Reusable Object Models, 
 Martin Fowler Data Model Patterns 
 David C. Hay https://www.amazon.pl/Enterprise-Patterns-MDA-Building-Archetype/dp/032111230X https://www.amazon.com/Data-Model-Patterns-David-Hay/dp/0932633749 https://www.amazon.com/Analysis-Patterns-Reusable-Object-paperback/dp/0134186052