Labels

programming (7) tools (7) rails (6) cluj (4) productivity (4) emberjs (3) misc (3) startups (3) internet (2) software (2) hack (1) meetup (1) os x (1) science (1)
Showing posts with label rails. Show all posts
Showing posts with label rails. Show all posts

Tuesday, October 15, 2024

Ruby on Rails: 10 years later, I’m still all-in

 


 "Good design is obvious. Great design is transparent." – Joe Sparano

Back in 2013, I was working on a piece of desktop software where the graphical engine was running on Fortran code older than disco music. The newer parts were built in C and C++, with complex dependencies and manual memory management. Every night, we’d kick off the build process, and it would take a full day for all the test cases to run across platforms. It wasn’t just a job; it was an endurance test.

Then came Ruby. I still remember that day at a local Coderetreat. Coming from C and Fortran, it was like stepping into the light. No semicolons to babysit, no battling with cryptic compiler errors. It was instant feedback, like nothing I had ever experienced before. You write the code, and the code just works.

That’s when I decided I wanted to become a Ruby on Rails developer. Because it was regarded as a mostly backend framework, I’ve also had to dive into frontend frameworks like Backbone, Angular, Ember, and more recently, React. Every time, I bought into the excitement. But the romance faded quicker than my excitement at a stand-up meeting. Aside from React, all of them fell out of favor for new projects, and much of what I invested in them now feels like lost time. Rails, however, has been a constant through it all. Rails is the anti-hype.

Hotwire brings back the simplicity of sending HTML over the wire, like it’s 1999. No build steps, no JavaScript fatigue, and no 10-minute npm installs. This is not something new. It evolved from Turbolinks, which was introduced all the way back in 2012 with the release of Rails 4. I’ve watched the JavaScript world spiral into complexity, and Rails has kept me sane.

Now, we’ve got Hotwire Native, which lets you extend this simplicity into mobile development. Write once in Rails, and your app is ready for web and mobile. No need for separate stacks or specialized knowledge of iOS or Android.

Rails developers have naturally evolved into DevOps pros without breaking a sweat. Chef, Capistrano, and Puppet: all born from the same Ruby DNA that powers Rails. I’ve learned and was made to feel confident that I can not only write code, but can also deploy it and manage infrastructure. When the term DevOps started gaining popularity, I never regarded it as a distant, off-limits specialization. In the Rails world, ‘full stack’ means the complete stack—from writing code to deploying and managing infrastructure. No handoffs to someone else.

In terms of speed, a recent study showed that in specific workloads, Ruby 3 outperformed C. There’s nothing wrong with Go or Rust, but I was never forced to abandon Ruby.

Shopify scaled Rails in ways that make tech pundits clutch their microservices manifestos in horror. Instead of rushing off to dismantle their app into a million microservices written in Go, they stuck with the monolith—because hey, when you’ve got a Ferrari, you don’t swap it out for a fleet of scooters. Instead, they built tools like Packwerk and Tapioca to manage complexity, while keeping the productivity of Rails intact.

I’ve worked at companies where the rush to ship new features overshadowed the importance of fixing bugs and maintaining code quality. It’s easy for developers to blame the framework, especially when they come from other languages. This is almost always a company culture issue—lack of proper, extensive, deeply technical onboarding, ignored technical debt, and incentives to ship features over fixing bugs. Rails isn’t the culprit, it’s your company’s culture.

From rapid prototyping as a solo developer to scaling a product that serves a billion users, Rails still allows you to do both. Onwards!


Tuesday, February 12, 2019

Impersonation in EmberJS

Our Rails 5 application needed a way for admins to impersonate regular users. We're using Ember (2.14) together with Ember Simple Auth, which supports multiple ways of session authentication using authenticators. I'm quite pleased with the result, the solution is elegant and doesn't feel like a hack.

We start off from the impersonation route:

  1. The impersonation route handler receives the email and authorization token as query parameters (from the admin panel) and processes them in the beforeModel() hook
  2. The authentication mechanism is initiated using the impersonation authenticator *but*
  3. the session data is changed to reflect what is normally used as a session authenticator (DeviseAuthenticator, in our case)
  4. Finally, sessionDataUpdated event is triggered which will eventually call DeviseAuthenticator's restore() without breaking the flow.

Saturday, November 26, 2016

Blending OAuth2 authorization with Devise using Ember Simple Auth

My Rails app already had authentication implemented using Devise and was serving some custom session data. Everything was elegantly tied together using Ember Simple Auth. I wanted to allow customers to sign-in / sign-up with Google using the OAuth2 mechanism.
I turned to Torii. Specifically, I was looking into Torii's OAuth2 provider to help me handle these OAuth2 phases:

1. Select & authorize APIs

This requires user consent; the user logs in with their Google account and is asked whether they are willing to grant the permissions that the application is requesting.

// in config/environment.js
var torii = ENV.torii = { providers: {} };
torii.providers['google-oauth2'] = {
      redirectUri: 'http://redirect.uri',
      apiKey:      'something.apps.googleusercontent.com',
      scope:       'email profile' // NODOC: scopes should be space-separated!
 
} 


Sunday, June 21, 2015

Ask Me Anything!

Codementor.io announced a new feature a couple of months ago: "Ask me anything" events, and I decided to create one, even though I never mentored anyone over there. At first, no one asked me anything until @codementorIO announced my event on Twitter and a bunch of questions came pouring.

I felt quite pleased of the answers, since it gave me a chance to voice a few of my current beliefs. I'm sharing them here. Feel free to ask me more questions in the comments below.

John S.: What are some projects that you been part of that lead you to see creating technology as a futurist? What exactly makes you a futurist? (also, I think that's a very apt and great way to explain your tech skill).

Your first question is interesting since I realize that it wasn't something specific I worked on. It's just something I realized and it might go back as far as my childhood. Most of my projects are related to software, and none of them are very extravagant. But they are enabling me to learn and do something extravagant in the future. I hope.

Friday, February 6, 2015

Cluj.rb: Speeding up your testflow

After a long hiatus, Cluj.rb brought together Thomas Morris of http://www.badassvim.com/ and myself to talk about our development setup. The discussions was, naturally, succeeded by beers.

Here's the demo app, and below, the slides.

Saturday, June 28, 2014

The inflexion point of programming confidence (or an outline to the benefits of Rails)

I've been working as Rails developer at a startup for more than a year. It was quite a change from working at an outsourcing company, on a mammoth written in Fortran/C/C++, with legacy code coming back from the 80s.

When I started working with Rails it felt like "starting to watch a soap opera in the 7th season." I was reluctant to blog about the new things I was learning because I felt I'm not yet at a point in which I'm capable of insights into this world.

I recently watched a talk by Yehuda Katz and I was glad to see that I've came across most of the things which make the Rails approach to web development so beneficial. The following are taken from the said talk.