4 ms·
> It's way-ay-ay more effort Just because you tend to ignore the many complexities that are actually involved in a form on a web page. It's exactly this bias t
by choeger 4y ago
> It's way-ay-ay more effort
Just because you tend to ignore the many complexities that are actually involved in a form on a web page. It's exactly this bias that stems from untyped languages and that needs to die. Http is a complex beast and we should either replace it with something more simple and robust or at least acknowledge the complexity in our programming.
Generally speaking, if doing something with a proof of type-safety feels complex, you probably ignored many corner cases before.
- deleted 4y ago[deleted]
- bcrosby95 4y agoIt's not complexity. It's pointless bookkeeping. If you don't cut corners on your static typing, you're looking at 2-4 single use classes per API endpoint: 1-2 for the web layer, and 1-2 when going into the domain logic layer. Many people skimp and just re-use the core domain class for everything, which is the worst of both worlds. I'll take a map, spec, and select-keys over this all day long.
- rictic 4y agoThat's if you write it in Java. With a type system like TypeScript's you can write largely the same code as before, with a few annotations to clarify what you mean, and you get the exact same runtime only you also will get compile errors if a change elsewhere in your program violates the assumptions of that code.
- samatman 4y agoI don't view Typescripts as a good argument against dynamic languages. I view it as a good case for a well-designed gradual type system for dynamic languages. All valid Javascript is Typescript, in a profound rather than trivial way.
- xigoi 4y agoStatically typed ≠ class-oriented
- wizofaus 4y ago2-4 single use type definitions per endpoint sounds pretty atypical to me, but I agree choice of language helps here, e.g. TypeScript has pretty powerful typing facilities (Pick/Partial etc) that make type reuse far more practical. It's bookkeeping yes, but definitely not pointless.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- preseinger 4y agoYour tools leave you open to type errors, which you have to de-risk via unit tests. That risk is automatically eliminated by static type systems. Dynamic typing is a reasonable choice for single-developer and/or toy programs but isn't inappropriate for projects maintained by teams over time.
- jhomedall 4y agoWhy would static types require you to create additional classes?