Last night a near 100 folks showed up at Hotel Tonight’s swank downtown offices to get nerdy about Rails.
There’s still a lot of excitement, innovation, and love happening in the Ruby world. After a bit of pre-show socialization with our fellow devs, the crowd settled in to hear the talks of the evening.
How Hotel Tonight uses ElasticSearch to power its hotel search algorithm
How did the love affair begin? Paul and Jatinder took a trip down memory lane, when Hotel Tonight was on a fairly normal looking Rails stack. They relied on a geolocation service + MySQL + ActiveRecord to manage listings.
When they first launched, this setup worked well. But, back in the day, they only needed to serve three cities. These days Hotel Tonight serves more than 2,000+ cities.
They give credit to ElasticSearch, as one of the big reasons why their search and ranking algorithms have been able to keep up. You get a lot of nice things for free with ElasticSearch. But, Paul and Jatinder were quick to note that with most abstractions there are a handful of drawbacks, as well.
Check their slide deck for more details on the pluses and minuses.
Advanced Ruby for Rails Developers
Sherif’s talk centered around methods, blocks, procs, and lambdas. Most folks are familiar with methods and blocks. However, many stumble when making the leap to procs and lambdas?
Why is that? To illustrate, Sherif paraphrased a favorite quote from Brian Kernighan:
“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it?”
So, does that mean you should never use procs and lambdas? Not quite. It just means, you need to get comfortable with with procs and lambdas. The best way to do that is through play.
In the spirit of play, Sherif convinced a few intrepid audience members to take the stage for a live coding demo. At this point I was simultaneously amazed and upset: “This is the coolest live coding demo I’ve ever seen,” paired with, “damnit, I wish we had a video recording of this.”
The goal of the demo was to illustrate the difference between arity and scope. The coders stumbled. The crowd at Hotel Tonight shouted helpful hints as they worked through. And, eventually, with a lot of laughter and a bit of perseverance they did it!
After the live exercise, Sherif veered towards the philosophical side: “I have bad news… You’ll remember there’s a difference between procs and lambdas. But, you won’t remember what it is.”
We all go through this process of learning and forgetting. As a coder we’re also constantly bombarded with new wiz-bang tools and solutions. What’s the best way to fight our tendency to forget?
Sherif advises, “Don’t”:
- Embrace confusion
- Have faith in your own work
- Keep exploring, playfully
He closed out the session with a look at some open Rails projects. We took a quick look at how procs and lambdas were getting used in the real world.
For a more detailed look, check out Sherif’s slides.
See you next time!
Thanks for everyone who showed up last night! And, special thanks to both our speakers and Hotel Tonight for making SFRails a blast.
The next meetup is set for November 17th. Hope to see you there!