3 ms·
> I don't know how much static typing I need The advantage of a type system is that you can restrict what you can do - which is a good thing. If you had to pai
by Noseshine 10y ago
> I don't know how much static typing I need
The advantage of a type system is that you can restrict what you can do - which is a good thing. If you had to paint something, it's much easier to add some shadow or improve or add a detail in an existing painting compared to getting the full freedom of a blank white sheet. Any design act, art or engineering, means to slowly restrict yourself more and more, until you came down from a universe with an infinity of options to having only one left.
A type system installs roads and rails, you still have the freedom to move but only on those roads. You have to install restrictions in any case: In your code, in your head. The type system makes them explicit, meaning they are easier to share in space and in time, with yourself (a week or a month later) and with other people.
Yes, it's one more tool to learn, but there is a reason it was invented instead of relying on "just code" and context. The good news: You can start simple and easy. No need to use complex type definitions right away. A lot of what the type system does is make restrictions explicit that exist anyway.
- lacampbell 10y agoTo be clear - I wasn't discussing the merits of static types. They are useful tools, and - all else being equal - I use them where available. It was more weighing up the cost benefit analysis of using something like Typescript, which would increase the complexity and the "cycle time" mentioned by the author.
- Noseshine 10y agoAh yes. Add to that that you have to choose between TypeScript and Flow - not as easy as one might think. Normally I go with the more wide-spread tool, but Flow has some good arguments on its side too, for example that it's "just types".