Ufuk Kayserilioglu
👤 PersonAppearances Over Time
Podcast Appearances
So we took a look at the ways dev fail, and we took a look at all the ways that dev fails that's related to type related problems. Any exceptions that Dev was raising, they were always like all being captured anyway. So any exceptions that it was raising that were type errors, no method errors, or argument errors, we collated that. So we drew graphs and everything.
So we took a look at the ways dev fail, and we took a look at all the ways that dev fails that's related to type related problems. Any exceptions that Dev was raising, they were always like all being captured anyway. So any exceptions that it was raising that were type errors, no method errors, or argument errors, we collated that. So we drew graphs and everything.
So that was before we started this experiment and we drew the same graphs for after we finished this experiment. And our findings are interesting. So we were actually able to completely eradicate name errors because that's the lowest hanging fruit. So the basic premise that Sorbet gives you is
So that was before we started this experiment and we drew the same graphs for after we finished this experiment. And our findings are interesting. So we were actually able to completely eradicate name errors because that's the lowest hanging fruit. So the basic premise that Sorbet gives you is
to ensure that all the constants are resolved somehow so that you don't have any constants that Sorbet doesn't understand in your code base. So, and that's what a name error is, right? Like you refer to foo, but foo doesn't exist. So you get a name error. And if you're not doing like const get or something, something dynamic in your code base,
to ensure that all the constants are resolved somehow so that you don't have any constants that Sorbet doesn't understand in your code base. So, and that's what a name error is, right? Like you refer to foo, but foo doesn't exist. So you get a name error. And if you're not doing like const get or something, something dynamic in your code base,
Just static analysis is enough to eradicate all the name error problems. And then we also looked at, like I said, type errors. There were a few type errors left still in the dev code base, but we did trace them back to files that weren't marked type true. And maybe I should just explain what type true, type false, all those levels are. Okay. So Sorbet is a gradual type checker.
Just static analysis is enough to eradicate all the name error problems. And then we also looked at, like I said, type errors. There were a few type errors left still in the dev code base, but we did trace them back to files that weren't marked type true. And maybe I should just explain what type true, type false, all those levels are. Okay. So Sorbet is a gradual type checker.
So you don't have to convert your hold code base to be typed overnight, but you can opt into as much of Sorbet as you want. So when I said, you know, we adopted Sorbet in our core code base, of course, I'm not saying like we, you know, added types across the whole code base, but we
So you don't have to convert your hold code base to be typed overnight, but you can opt into as much of Sorbet as you want. So when I said, you know, we adopted Sorbet in our core code base, of course, I'm not saying like we, you know, added types across the whole code base, but we
enabled all the developers to add those type signatures and to have their codes checked against those type signatures. So the same thing in dev. So we did add types to the majority of the dev code base, but not to all of it. And we were able to track the type errors to the parts of the code base that were where the files were marked type false. And type false says
enabled all the developers to add those type signatures and to have their codes checked against those type signatures. So the same thing in dev. So we did add types to the majority of the dev code base, but not to all of it. And we were able to track the type errors to the parts of the code base that were where the files were marked type false. And type false says
Do not type check any of the method calls in this file. Only check that like the constants resolve to constants that you know. It does the basic type checking. Whereas in type true, the file is type checked for all the method calls and for all the parameters that are being passed correctly. And if the methods have signatures, that all the methods have the correct types.
Do not type check any of the method calls in this file. Only check that like the constants resolve to constants that you know. It does the basic type checking. Whereas in type true, the file is type checked for all the method calls and for all the parameters that are being passed correctly. And if the methods have signatures, that all the methods have the correct types.
Yes. So the name errors is the lowest hanging fruit because you take a typed false on top of your file and run sorbet over it. And it will tell you, oh, you have this constant that you're referring to here in this file, but I have no idea what it is. So it's either coming from somewhere else in your code base that Sorbet isn't processing, or it really doesn't exist.
Yes. So the name errors is the lowest hanging fruit because you take a typed false on top of your file and run sorbet over it. And it will tell you, oh, you have this constant that you're referring to here in this file, but I have no idea what it is. So it's either coming from somewhere else in your code base that Sorbet isn't processing, or it really doesn't exist.
So you just, you know, remove your usage of it. So name error was a simple one, but we were able to reduce type errors as well. And we also realized that we were able to reduce argument errors and no method errors as well, though not to the same extent. Because even though you're opting into types, there are still situations where when you call a method, the method doesn't have a signature.
So you just, you know, remove your usage of it. So name error was a simple one, but we were able to reduce type errors as well. And we also realized that we were able to reduce argument errors and no method errors as well, though not to the same extent. Because even though you're opting into types, there are still situations where when you call a method, the method doesn't have a signature.
Sorbet's best guess is it could return anything. that's represented as a T untyped in Sorbet. That's the equivalent of any in TypeScript if you've worked with TypeScript before. So it's a type that can be anything. So you can call any methods on it with any parameters. So basically Sorbet stops doing type checking past that point.
Sorbet's best guess is it could return anything. that's represented as a T untyped in Sorbet. That's the equivalent of any in TypeScript if you've worked with TypeScript before. So it's a type that can be anything. So you can call any methods on it with any parameters. So basically Sorbet stops doing type checking past that point.