![]() ![]() In fact, in the list of 400 bugs analyzed, projects that have no automated tests at all seems to be the norm. I applaud the scientific attempt to analyze the impact of types, but I found something that makes me take that number with a grain of salt: it does not consider the presence of automated tests. TL DR: both Flow and TypeScript are pretty good, and conservatively either of them can prevent about 15% of the bugs that end up in committed code.ġ5% fewer bugs with types is a pretty bold statement. ![]() I was really curious about this article that empirically tested how Javascript type checkers would reduce bugs by a 15%: Types aren’t just in my list of factors affecting code quality. I have worked with Java and C# quite a bit too, so I am familiar with typed languages. It improves collaboration by large teams on large codebasesĪfter many years of writing Ruby and Javascript, I never identified type-checking as a source of brittleness in the apps I have worked on.I observe 2 recurring reasons for static type checkers: To me, this is the most intriguing aspect of the types discussion. I think this is a good thing, but not be a game changer if you are already using an IDE. It seems that type annotations will standardize IDE-like services for dynamic languages so that any plain editor can leverage on them to offer advanced code assist. A significant percentage of my code editing activity is renaming things and extracting methods and Rubymine handles this perfectly, although I am sure types will make for even better refactoring support. Sure that types help, but it is also amazing how far a sophisticated IDE can go without them. Last year I did a fair amount of C# with Rider, and I was surprised how little difference I found when it comes to refactoring and autocompletion, compared to my work with Ruby and Javascript. I have been doing this with Rubymine for many years so it doesn’t sound that revolutionary to me. If you come from using “Find and replace” I totally see how this can blow your mind. People often speak about how wonderful is autocompletion, being able to rename things or find usages when using Typescript (and now with Sorbet). When you read about what benefits types bring, there are always 3 recurring themes: On the other, a lot of smart people and companies are embracing them, and this makes me want to give them a try.On the one hand, I don’t miss them at all.I have mixed feelings about using types in Ruby or in Javascript: Along with the impact of Typescript and with types coming to Python, it is evident that static type checkers for dynamic languages are gaining a lot of traction, and this piece is my attempt to clarify my own thoughts about it. It was also recently announced that types will be coming to Ruby 3. Stripe recently open sourced Sorbet, a ruby type checker.
0 Comments
Leave a Reply. |