Rewrite It in Rails
The author developed a customs declaration app using Ruby on Rails for its speed, later attempted a rewrite in Rust and SvelteKit, but reverted to Rails due to user needs and challenges.
Read original articleIn 2022, the author began developing a customs declaration application, initially experimenting with various programming languages and frameworks before settling on Ruby on Rails due to familiarity and speed. Despite intentions to eventually rewrite the application in a different language, the Rails version quickly gained functionality and user approval. The author then attempted to create a "version 2" using Rust and SvelteKit, which proved challenging due to Rust's lack of comparable frameworks and the extensive plumbing required. As the Rails application continued to evolve and improve, the author realized that the new stack was not delivering the necessary value to users. After a year of development, the decision was made to revert to Rails for the parts of the application that had been rewritten in Rust and SvelteKit. The author acknowledged the strengths of Rails, including its mature ecosystem and ability to facilitate rapid development. Ultimately, the experience underscored the importance of making trade-offs in web application development and the value of learning from different programming languages and frameworks.
- The author initially chose Ruby on Rails for its speed and familiarity.
- Attempts to rewrite the application in Rust and SvelteKit faced significant challenges.
- The decision was made to revert to Rails for parts of the application due to user needs.
- The experience highlighted the importance of trade-offs in web development.
- Learning from different languages and frameworks can enhance programming skills.
Related
Rails Is Good Enough
Onur Ozer discusses the lasting significance of Ruby on Rails, highlighting its use by startups and large companies, its productivity, and its ability to simplify web application development over two decades.
I'm Back, Ruby on Rails
The author reassesses Ruby on Rails, praising its stability, built-in features, and supportive community, while highlighting its advantages for rapid development and deployment, making it suitable for startups.
Building the Same App Using Various Web Frameworks
The author compares web frameworks FastAPI, FastHTML, Next.js, and SvelteKit by building the same application, noting their unique features and complexities, while expressing interest in TypeScript and learning resources.
Ruby on Rails continues to thrive
Ruby on Rails, established in 2005, remains a powerful web development framework favored for rapid project initiation, scalability, and strong community support, with major companies continuing to rely on it.
Lessons learned from a successful Rust rewrite
The transition from C++ to Rust improved code performance and safety but revealed challenges like undefined behavior, memory management issues, and tooling limitations, highlighting the need for a stable ABI.
I have tried Meteor (back in the day), Remix, Nextjs, Node w/ Express, etc. Always talking about how much better they are. But in my mind web dev is a solved problem. The js stuff is mainly just developers wanking off, driven by a bunch of dollars from big companies.
Systems stuff, deployment infra, etc. is great for stuff like Rust & Go, but shoehorning into web dev makes no sense. I would love to just move on from this debate but it seems thats going to never be possible.
I've written my fair share of far too long ruby methods, 200 lines and more, but those are truly my fault. With a more granular unit test regime those can be prevented.
>> Interestingly, all of the things that used to annoy me about Ruby and Rails now annoy me much, much, much less. I have accepted that there is no perfect language or framework. You just have to know its strengths and weaknesses and deal with them.
Choosing something like Java, C# or Go might not sound sexy or cool, but with get the job done as fast as Rails while running almost as fast as Rust. That choice will also generally mean less bugs and a having a project that is easy to maintain and extend.
I'd recommend anyone who'd be interested in "Rails, but in TS" to give it a go.
It feels much more similar to rails (or Laravel) than the most popular TS stacks, and also has "batteries included" instead of leaving you to decide on every part of your stack (or trust a template from a third party).
Node.JS developers are starting to realize it's not just about having the ecosystem and the tooling, it's also about the framework being a holistic solution to building out your application. That's what NextJS and SvelteKit help with, and that's what Rails revolutionized back in 2006.
I’ve found that perf issues were much more often caused by the DB queries than by Django itself.
It's like using Rails to write a database or a DNS server. You're just trying to use the wrong tool for the job.
I looked into Ruby's static typing attempts but the picture painted was grim.
I think decent type checking can fix many of the usual bugs people encounter, but the syntax for types at least needs to be decent.
Our user-friendly and featureful website was a big part of our appeal. A lot of the non-Rails functionality was the unseen "secret sauce".
I think this approach worked well. Most of what you need for a web app is commodity functionality. Correctness is not even particularly important in many cases. The Rails ecosystem has a lot of useful tools that make it easy. For example, there are multiple options for automatically adding a comprehensive admin panel. This let our non-technical admins manually accomplish CRUD tasks in the web app's domain. This allowed us to avoid overengineering. We could implement something that covered 80% of cases, and manually handle any edge cases or things that happened infrequently. An example is locking user accounts when a person left a customer's company; they could just email us and an admin would manually go in and check the "locked" box for the user. This allowed us to move very fast on new web app features, and focus on other aspects of the system.
There were downsides, of course. One of the big pain points was upgrading Rails itself, and dealing with dependency hell at times with various libraries. You also have to know many things about how Rails works, which involves a lot of quasi-mysterious and implicitly-performed things. For example, I recall frequently coming across function calls, and then I would look for the function definition, only to find that it was a function that doesn't exist in the code and was generated at runtime by Rails.
In this thread and others, HN does a lot of talking about the fixed properties of these languages and frameworks.
Something I don’t see much is: choose the tool that you and your team are most familiar with.
It’s relatively easy to learn a new language, but it takes a long time to learn an ecosystem. Learning that ecosystem takes time away from focusing on your customer.
I recently started a new web app and tried to use Django because of the batteries-included framework “should” have been the right tool for the job.
But I haven’t used Django in 15 years and it was slow going. After a few weeks of slow going, I rewrote the whole thing in Typescript in a week. Not because of any general argument that TS is better, but because it’s the ecosystem I know well. Not by choice, but as a function of the jobs I’ve had.
I’d like to suggest that it’s okay to choose the tool you’re most familiar with, because you’ll move faster, write better code, and frankly web apps can be written in any of these languages.
> After probably a good year of writing Rust and Svelte, it dawned on me that our users didn't benefit from any of this.
> With days and often weeks on end being spent on adding absolutely no direct value
> these last weeks I've felt very productive again, building new features, improving existing ones, updating the UI, fixing stupid bugs. I also really enjoy working more closely with my colleagues who use the application all day, every day and figuring out how I can make the product better for them.
Rails is GREAT at solving PRODUCT problems very quickly and very effectively. In the right place there is nothing better at building _products_ or making engineers incredibly productive.
It's not the only tool in the toolbox, but it's always been one of the best to solve early applications and proofs of concept
It doesn’t seem like the author learnt that much. They know Rails and Rails is good for making webapps? Makes sense.
[1] For the author. The rest of the team didn’t know Rails. And there was no one on the team that knew that rewriting parts in “blazing fast”-lang would work.
Rails is very good until you need to go off rails. Even in that case rewrites must be partial and not to aim to fully replace the original. Most of the time rewrites are a waste of time. This article could be true if you s/Rust/Ruby and tell the story in the opposite direction.
The worst is TypeScript and Node.js.
A lot of startups are making their code bases in TypeScript. And it is an unbearable mess.
I recently consulted with a company where I rewrote their app in Rails. And now it's much simpler, much better, much more extensible, and far more enjoyable for the developers to work on it.
"Have many issues at runtime? Test more. Does it turn into unmaintainable spaghetti code after a while? Only if you let it. It's typically caused by developers, not programming languages or frameworks."
Rails developers smugly assert that Ruby on Rails is more productive than anything else out there.
I call BS on the "Ruby On Rails is the very best by far" conceit.
Ruby On Rails has a monopoly only on the perception that its developer experience and productivity is off the charts.
Ruby On Rails is just another language and framework. There's literally nothing that makes it different or particularly special compared to anything else.
Developers everywhere with Python or nodejs or TypeScript or C# or Golang have a developer experience that is just as great, without the high handed conceit that what they are doing is amazingly better than anything else.
Ruby, and Rails, was an awful idea then and it's an awful idea now. Even in-browser stuff is moving to typescript to get away from having to write unit tests for basic type errors.
But sure, let's dig up this failure and try it again
You pay 100x for each line of code and get nothing in return over ASP.NET Core or Vert.X. Pick any fast compiled language you like, don’t contribute to global warming.
Related
Rails Is Good Enough
Onur Ozer discusses the lasting significance of Ruby on Rails, highlighting its use by startups and large companies, its productivity, and its ability to simplify web application development over two decades.
I'm Back, Ruby on Rails
The author reassesses Ruby on Rails, praising its stability, built-in features, and supportive community, while highlighting its advantages for rapid development and deployment, making it suitable for startups.
Building the Same App Using Various Web Frameworks
The author compares web frameworks FastAPI, FastHTML, Next.js, and SvelteKit by building the same application, noting their unique features and complexities, while expressing interest in TypeScript and learning resources.
Ruby on Rails continues to thrive
Ruby on Rails, established in 2005, remains a powerful web development framework favored for rapid project initiation, scalability, and strong community support, with major companies continuing to rely on it.
Lessons learned from a successful Rust rewrite
The transition from C++ to Rust improved code performance and safety but revealed challenges like undefined behavior, memory management issues, and tooling limitations, highlighting the need for a stable ABI.