Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

BUSINESS ARCHETYPES PATTERNS WITH RAILS

Slide 3

Slide 3 text

How to help the feeling that somebody already solved your problems BUSINESS ARCHETYPES PATTERNS WITH RAILS

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

Hero archetype generated by DALL·E 3

Slide 7

Slide 7 text

BUSINESS ARCHETYPE

Slide 8

Slide 8 text

PARTY INVENTORY CRM PRODUCT ORDER RULE BUSINESS ARCHETYPE

Slide 9

Slide 9 text

BUSINESS ARCHETYPE PATTERN

Slide 10

Slide 10 text

HOW TO FIND ARCHETYPE PATTERNS Literature Experts Business domain

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

ARCHETYPE 
 PARTY

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

<> 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

Slide 16

Slide 16 text

ARCHETYPE 
 PARTY Person Organisation

Slide 17

Slide 17 text

ARCHETYPE 
 PARTY Person Organisation Identifier Registered identifier

Slide 18

Slide 18 text

Party Signature ARCHETYPE 
 PARTY Person Organisation Identifier Registered identifier

Slide 19

Slide 19 text

Party Signature ARCHETYPE 
 PARTY Person Organisation Name Identifier Registered identifier Address Preferences

Slide 20

Slide 20 text

Party Signature ARCHETYPE 
 PARTY Person Organisation Name Identifier Registered identifier Address Preferences Party Manager

Slide 21

Slide 21 text

ARCHETYPE 
 PARTY RELATIONSHIP

Slide 22

Slide 22 text

Family Relationship Parent Child Parent Son Father Son Family Level of abstraction Symmetry generated by DALL·E 3

Slide 23

Slide 23 text

Party Role Party Relationship Party Role Party Leia Sister Siblings Brother Luke Asymmetrical relationship Party

Slide 24

Slide 24 text

ARCHETYPE 
 PARTY RELATIONSHIP Party Role Party Relationship

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

Party Role Type ARCHETYPE 
 PARTY RELATIONSHIP Party Role Party Relationship Party Relationship Type

Slide 27

Slide 27 text

<> 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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

ARCHETYPE PARTY What relationships are worth to capture? At what level of abstraction? Who can be connected with whom? Questions you should ask yourself

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

github.com/maikhel/business-archetypes

Slide 35

Slide 35 text

My insights Capture characteristic or just existence of relationship? ActiveRecord vs archetype approach Problems with searching Modeling Rules of relationships

Slide 36

Slide 36 text

ARCHETYPE 
 PRODUCT

Slide 37

Slide 37 text

Goods or services your business sell PRODUCT

Slide 38

Slide 38 text

Unique product Product types Identical product Identifable product

Slide 39

Slide 39 text

ARCHETYPE 
 PRODUCT Product Type Product Instance

Slide 40

Slide 40 text

<> ProductIdentifier productIdentifier: String getIdentifier(): String 0..* << archetype >> ProductInstance 1 1 1 << archetype >> Product Type <> UniqueIdentifier getIdentifier(): String <> SerialNumber serialNumber: String getIdentifier(): String 0..1 << o >> 1

Slide 41

Slide 41 text

ARCHETYPE 
 PRODUCT Product Type Product Instance Product Batch

Slide 42

Slide 42 text

ARCHETYPE 
 PRODUCT Product Type Product Instance Product Batch Product Specification

Slide 43

Slide 43 text

ARCHETYPE 
 PRODUCT Product Type Product Instance Product Batch Product Specification Product Catalog Catalog Entry

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

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

Slide 46

Slide 46 text

ARCHETYPE 
 PRODUCT Product Type Product Instance Product Batch Product Specification Product Catalog Catalog Entry Package Type Package Instance Package Pricing Product Relationship

Slide 47

Slide 47 text

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

Slide 48

Slide 48 text

github.com/maikhel/business-archetypes

Slide 49

Slide 49 text

My insights Optimize the system/models structure for proper product type Don’t confuse Products with Catalog Entries Have a separate model for Price

Slide 50

Slide 50 text

ARCHETYPE 
 INVENTORY

Slide 51

Slide 51 text

ARCHETYPE 
 ORDER

Slide 52

Slide 52 text

ARCHETYPE 
 RULE

Slide 53

Slide 53 text

ARCHETYPE 
 CRM

Slide 54

Slide 54 text

Use only elements you need generated by DALL·E 3

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

Thank you!

Slide 57

Slide 57 text

Questions? https://maikhel.github.io