Designing from outside-in
One of the great things about applying DI from the start of a project is that it gives us the ability to defer decisions until we are better informed to make them.
For example, after deciding to implement a HTTP REST service, we can then proceed to design our endpoints. When designing our Get endpoint, we could describe it like so:
The get endpoint returns a person object in JSON with the form {"id":1,"name":"John","phone":"0123456789","currency":"USD","price":100}
You might notice that this only describes what the user needs, and does nothing to specify where the data is coming from. We can then actually code our endpoint to achieve this exact goal. And it might even look a lot like this, from Chapter 10, Off-the-Shelf ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access