2 ms·
> It makes it very difficult to comply with Postel's Law. Not really, since “handling” doesn’t mean “throw errors”. But regardless, Postel’s Law is often seen
by klmr 8y ago
> It makes it very difficult to comply with Postel's Law.
Not really, since “handling” doesn’t mean “throw errors”. But regardless, Postel’s Law is often seen as a failure in hindsight. See the “Criticism” section on its Wikipedia page. In general you don’t want to comply with Postel’s Law.
- bunderbunder 8y agoHandling shouldn't mean "throw errors". But the whole process of creating Beans or immutable POJOs and then decorating them with annotations seems to invariably lead you down a path where, if you're dealing with a particularly hoary API, you've either got to create a ridiculous number of single-use DTOs to handle all the edge cases, or define a manageable number of DTOs that unfortunately also place more stringent requirements on the input data than are strictly necessary.
- klmr 8y agoWell Java is just an incredibly bad poster child for static typing. But even in Java you can do better by using modern sum types. Defining a “ridiculous number of single-use DTOs” isn’t actually a problem in languages that support this well (e.g. by allowing you to create anonymous tuples). But as you’ve said yourself: this only applies to “pretty hoary APIs”. Why not take the opportunity to create a better API (through a wrapper, if you have no control over the original API)?