-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Replace string length constraint with business logic guards, and ad…
…d unit tests (#286) * Hero: Add name & alias guard and add tests * Remove string length constraints * Add migration and add ADR * Power: add tests * Hero: Update tests and rearrange null guard to come first * Added TeamTests * HeroesTests: renamed to HeroTests to match domain name * Added Id comparison tests
- Loading branch information
1 parent
23fa27e
commit 93d8e0c
Showing
15 changed files
with
763 additions
and
41 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
docs/adr/20240415-replace-string-length-constraints-with-better-business-rules.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Replace database string length constraints with better business rules | ||
|
||
- Status: accepted | ||
- Deciders: Matt Wicks, Matt Goldman, Chris Clement, Daniel Mackay | ||
- Date: 2024-04-15 | ||
- Tags: database, domains | ||
|
||
Technical Story: https://github.com/SSWConsulting/SSW.CleanArchitecture/issues/285 | ||
|
||
## Context and Problem Statement | ||
|
||
As we are moving forward to make sure that CleanArchitecture template is lean and can be used | ||
straightforward in modern projects, we are going to drop technical constraints such as string length in names and description | ||
and instead opt to add more rules which adhere more to the example business logic (e.g. a hero name and alias cannot be the same). | ||
|
||
## Decision Drivers <!-- optional --> | ||
|
||
- Make sure faster setup time for CleanArchitecture templates in modern projects | ||
- Reduce arbitrary technical concerns in database that does not stem from thoughtful requirements | ||
|
||
## Considered Options | ||
|
||
1. (Recommended) Replace string length constraints with non-technical requirement | ||
2. Drop string length constraints and do not replace them | ||
3. Keep string length constraints but split the constants to each domain | ||
|
||
## Decision Outcome | ||
|
||
Chosen option: "Replace string length constraints with non-technical requirement", because we want to | ||
keep the example of guard clauses in the code. | ||
|
||
## Pros and Cons of the Options <!-- optional --> | ||
|
||
### 1. Replace string length constraints with non-technical requirement | ||
|
||
- ✅ Guard clauses example | ||
- ✅ No shared constraint values | ||
- ❌ No example of linking domain constraints to infrastructure implementation | ||
|
||
### 2. Drop string length constraints and do not replace them | ||
|
||
- ✅ No shared constants | ||
- ❌ No guard clauses example | ||
|
||
### 3. Keep string length constraints but split the constants to each domain | ||
|
||
- ✅ No changes to code | ||
- ✅ Guard clauses example | ||
- ❌ Shared constraint values for different entities / across aggregate root | ||
- ❌ Template starts with limit to string length which might not be needed / different value needed for different projects | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.