3 ms·
This post is not very good. DRY is a really solid principle (pun intended.) If you have to define the payload schema for an API yourself (i.e. the API provider
by greenthrow 4y ago
This post is not very good.
DRY is a really solid principle (pun intended.) If you have to define the payload schema for an API yourself (i.e. the API provider doesn't supply a library for you) then you really should define that in one and only one place. It doesn't matter thst today you only want a "handful" of hard coded JSON dicts. That path quickly leads to so many headaches and run time errors.
Implementing the API schema in one and only one place means you limit the sources of bugs for all code that deals with it. You only have to test that functionality in the one place it is defined, if it changes you don't jave to chase down hard coded JSON all over your codebase, etc
This post basically amounts to "I want to write lazy bad code and DRY tells me not to."
- Pr0ject217 4y agoI'm interested to know more about what you mean in this context by "define the payload schema for the API yourself". Can you provide an example?