Last active
January 23, 2021 17:36
-
-
Save ykayacan/ec19d7c43fbbadf2ef6109f5b5d97bb5 to your computer and use it in GitHub Desktop.
[Software Architecture] #architecture
- Value Objects
- Immutable
- A value object is equal if all properties are equal.
- Entities
- Optionally mutable
- An entity object is equal if ids are equal.
- Aggregate Roots
- Repositories
- Factories
- Services
- Which Entities are present in most or all API operatios?
- Which Entity if deleted would result in the deletion of some or all other Entities?
-
On the left side, the adapter depends on the port and gets injected a concrete implementation of the port, which contains the use case. On this side, both the port and its concrete implementation (the use case) belong inside the application;
-
On the right side, the adapter is the concrete implementation of the port and is injected in our business logic although our business logic only knows about the interface. On this side, the port belongs inside the application, but its concrete implementation belongs outside and it wraps around some external tool.
-
Left side: Primary or Driving Adapters
-
Right side: Secondary or Driven Adapters
Source: https://herbertograca.com/2017/09/14/ports-adapters-architecture/
Story: Account Holder withdraws cash
As an Account Holder
I want to withdraw cash from an ATM
So that I can get money when the bank is closed
Scenario 1: Account has sufficient funds
Given the account balance is \$100
And the card is valid
And the machine contains enough money
When the Account Holder requests \$20
Then the ATM should dispense \$20
And the account balance should be \$80
And the card should be returned
Scenario 2: Account has insufficient funds
Given the account balance is \$10
And the card is valid
And the machine contains enough money
When the Account Holder requests \$20
Then the ATM should not dispense any money
And the ATM should say there are insufficient funds
And the account balance should be \$20
And the card should be returned
Scenario 3: Card has been disabled
Given the card is disabled
When the Account Holder requests \$20
Then the ATM should retain the card
And the ATM should say the card has been retained
Scenario 4: The ATM has insufficient funds
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
