3 ms·
I work at Shopify (not the team that does YJIT) so I am working on a very large, modern Rails codebase. (my opinions are my own) I think rails code is the easi
by ecshafer 3y ago
I work at Shopify (not the team that does YJIT) so I am working on a very large, modern Rails codebase. (my opinions are my own)
I think rails code is the easiest code to follow in any code base that I have ever worked on. The enforcement in the framework of the code structure, models containing the object and schema relationships, focus on message passing, skinny controllers. Its very very easy to debug rails code and work in code that is relatively foreign due to the consistency across the code base. Some of this might be discipline at Shopify, I do think we have a very good code review culture. But I have been places that rest controllers just led to a spaghetti of "Operations" and "Processors" that just change state everywhere and a bunch of microservice network calls.
Ruby speed hasn't been an issue. We focus on latency and speed quite a bit and work on keeping request times low. The speed of ruby running is a good trade off for the speed of development I think. And most slow running requests really seem to end up due to network io or database calls that I see.
Sorbet uses a kind of type annotation, its very ugly and I do not like it. I really would prefer something more built into the language. Like def foo(Integer x) -> Integer. The big issue is method arguments I think since Ruby already uses :x, x:, x =, and a lot of the other symbols that indicate types so its hard to add it in an optional fashion.
- graypegg 3y agoJust curious, what's your opinion on YARD comments for typing? I have a little more experience with that, than I do Sorbet (or RBS as well) and I found it to be at least tolerable. Though something like your `-> Integer` would be amazing though if there was somehow a way to make it work with the syntax of Ruby.
- ecshafer 3y agoThe RBS syntax I like, I don't like how its a separate file though. I haven't used YARD but I think it would have similar issues to Sorbet. I much prefer things to be inline in programming languages in general. YARD looking at it, makes me think of Javadoc, which I always saw the issue with it being that it drifted from implementation over time as people don't update it. Sorbet does enforce it to be updated, and will throw an exception so your build will fail. Does YARD do that?