Talks

Crafting elegant code with ruby DSLs

Crafting elegant code with ruby DSLs

by Tom de Bruijn

In the talk "Crafting elegant code with ruby DSLs," Tom de Bruijn, a software developer at AppSignal and organizer of various Ruby community events, discusses his passion for Ruby programming and how it enables developers to write clean and elegant code. The presentation, delivered at Friendly.rb 2023, emphasizes the joys and challenges of metaprogramming in Ruby, a topic that resonates with many developers.

Key points discussed include:

- Introduction to Ruby: Tom expresses his love for Ruby, highlighting its ability to allow developers to write elegant code without hindrance.

- The Role of Metaprogramming: Tom admits to a complex relationship with metaprogramming, acknowledging both its potential for creating elegant solutions and the pitfalls he has faced, which lends credibility to his insights.

- Professional Background: As a developer at AppSignal, Tom shares the origins of the company, which started as a simple Ruby gem aimed at monitoring Rails applications, reflecting on the evolution of the product to include various other frameworks such as Sinatra and Hanami.

- Challenges in the Real World: Tom addresses the complications that arise when implementing metaprogramming in real-world applications. He shares anecdotes about support issues, where users encounter functionality problems with their gems, challenging the ideal of seamless integration that he strives for.

- Practical Approach: Through his experience, Tom stresses the importance of understanding what works and what doesn’t when employing metaprogramming in Ruby, helping listeners learn from his mistakes to foster better practices in their coding endeavors.

Overall, Tom encourages Ruby developers to embrace the elegance that Ruby offers while remaining cautious and informed about the challenges that metaprogramming may introduce. His talk serves as both a celebration of Ruby and a guide to navigating its complexities effectively.

00:00:05.839 I'm here today because I love Ruby, and I hope you are too. Let me see a show of hands.
00:00:10.920 I'm here because I hate jobs, which is also a valid reason. We accept that here.
00:00:18.840 Ruby allows me to write really elegant code. It doesn't get in my way. I can just be a happy developer, which is the intended purpose.
00:00:25.080 But, perhaps more controversially, I also love metaprogramming a lot. Maybe it's because of my day job, but I've been burned by metaprogramming flames before, so I kind of know what not to do and what to do.
00:00:31.359 So, I hope that you can trust me a little bit about what I'm talking about today. My name is Tom de Bruijn, but I go by Tom Brown on most platforms.
00:00:37.239 I'm a developer at the aforementioned AppSignal. We are an Application Performance Monitoring (APM) tool.
00:00:43.000 We track errors, performance metrics, logs, and all kinds of other things. Originally, we started with just a Ruby gem to monitor some Rails applications and to gather useful data, because New Relic was getting too complicated.
00:00:54.440 So, it started really simple, but immediately, it involved metaprogramming since the first thing we had to do was hook into Rails and extract data from it.
00:01:07.880 Since then, we've added support for Sinatra, Hanami, Delayed Job, and too many gems to list. You add a Ruby gem, authenticate it, and it should just work.
00:01:14.280 You should easily get all those metrics and data, but unfortunately, this is the real world, and things don't always just work.
00:01:25.920 Over time, we received a lot of support issues from people saying, 'Hey, great Ruby gem, but I just don't see any data,' or 'It doesn't work.'