2 ms·
> Why create a separate type over this class which is just a projection of its data? Because it lets you refactor your API separately from your domain. And use
by stickfigure 6y ago
> Why create a separate type over this class which is just a projection of its data?
Because it lets you refactor your API separately from your domain. And use the full power of the IDE/typechecker in both cases.
This approach especially shines with JAX-RS; you can write fully typed tests against your API methods, which look like pure logic functions.