Two concepts.
Explain them both, give answers to the following questions.
- Parse don’t validate
- What does this mean?
- What does this look like in code?
- What are the benefits?
- What is the trade-off?
- Value objects
- What are they?
- What does this look like in code?
- What are the benefits?
- What is the trade-off?
- What does a value object look like that adheres to both?
- What is the trade-off?
- Improve with the Result
pattern.
Parse don’t validate
For example when retrieving data from a 3rd-party API. Let’s start with some ideas on what that data can be before I choose one for this write-up.
- a set of permissions
- a list of products
- a list of connectors of an EVSE.
Lets go with the latter for now