Talks

The Transformation of Trailblazer

The Transformation of Trailblazer

by Nick Sutterer

The video titled "The Transformation of Trailblazer" features Nick Sutterer as he presents the history and evolution of the Trailblazer project during the Ruby Warsaw Community Conference Summer Edition 2023. The talk provides a detailed overview of the important milestones and contributions that have shaped the Trailblazer business logic framework over two decades. Key points discussed include:

  • Introduction to Trailblazer: The speaker begins by engaging the audience with humor and personal anecdotes about his experiences in the community, emphasizing the open-source nature of his work.

  • The 'Cells' Gem: Sutterer describes his initial challenges with creating reusable view components in Rails, which led him to develop the 'cells' gem. He explains how this gem enhanced encapsulation and modularity in web applications by allowing HTML fragments to be treated as components.

  • Serialization and Parsing: The discussion transitions to the challenges faced with serialization and the introduction of the 'representer' gem. Sutterer outlines the importance of formalizing document formats for JSON and XML to ensure consistency and ease of testing.

  • Reform Gem for Forms: The talk highlights the evolution of managing HTML forms and validations with the Reform gem, demonstrating how separating validation logic into distinct classes provides clarity and improves testability.

  • Operations and Encapsulation: Sutterer emphasizes the move towards operations within the Trailblazer framework to manage business logic outside of controllers. This approach allows for cleaner code and better test structures.

  • Community and Future Directions: He reflects on the importance of community engagement and collaborative learning in the development process, encouraging attendees to embrace new ideas and maintain open lines of communication.

In conclusion, the speaker stresses the significance of clean architecture and encapsulation in software development, advocating for thoughtful discourse and shared learning among developers. He invites audience members to connect and continue the conversation, emphasizing that the community's growth relies on collective experiences and knowledge-sharing.

The video serves as both a retrospective and a forward-looking perspective on the Trailblazer framework, tying together its historical roots with its ongoing evolution within the software development landscape.

00:00:09.260 I will try to introduce him a bit. You know that this guy is responsible for the Trailblazer project. If you don't know what it is, you probably need to catch up. This guy has a lot of slides, tags, and stars on GitHub. I don't know why, maybe because he is doing open source full-time, or maybe because he is good at teaching and speaking, especially while drinking beer.
00:00:20.820 Okay, I have one cool story to tell. This guy, at the conference last year, brought and shared beers with all the attendees. It wasn't in the morning; it was during the third and fourth presentations of that day, but I remember this track was really happy that you brought him this healing pattern. So, thanks!
00:00:39.480 Thank you so much! I wasn't aware if this was going to be a conference or a meet-up because I was told that this is a meet-up. It’s a bit more than expected, which is why I have awesome slides with me. It's all because of you! I wanted to give a professional conference talk and not just a meet-up presentation. Sorry for drinking beer on stage, but I just had to give three hours of workshops where we already drank beers.
00:00:59.879 I was really thirsty afterwards, and that’s why I needed to do that on stage. It would be nice if you could start randomly applauding, collating, and yelling every now and then, because otherwise, I'm going to fall asleep.
00:01:19.619 So, there's a massive problem in my life, but it’s not alcoholism. I was kind of talking about what to speak at this conference, work meet-up, whatever. Mario told me to please not talk about the same stuff I talked about in the workshop because some people will be bored.
00:01:25.680 I was kind of wondering, okay, what should I talk about? Neuroscience or quantum physics? Those are hobbies of mine. Anyway, I'm basically talking about the same stuff I did at the workshop. For those who attended, I recognize a few faces; you will be bored to death. For everyone else, you will be entertained till the end. By the way, why were you not at the workshop?
00:01:46.560 It's Friday, so that means you don't want to think. That's why you didn't come to your workshop. Okay, I had to change this talk a little bit to not make it an exact representation of the content from my workshop.
00:02:03.780 I added a lot of content, actually. I structured this talk in a chronological way to showcase some milestones of the open-source career of Trailblazer, hence the name. It's really beautiful, right? Wow! It's so nice. Okay, so I built this talk to highlight important waypoints of the Trailblazer career, and that's not only about me; there are a few other contributors as well.
00:02:39.599 I want to start with the most exciting compliment I ever received. People kept calling me or our project the 'architecture astronaut.' I find astronauts pretty cool; they have hobbies like neuroscience and quantum physics. But apparently, it was meant as an insult several times throughout my life. We'll re-encounter this term, 'architecture astronaut,' because basically, everything in Trailblazer involves too much abstraction. If you do too much abstraction, you're apparently an astronaut. But anyway, to understand the history of Trailblazer, we have to go back in time a little.
00:04:00.239 This is me. Look at me! I'm young and full of passion; I have no wrinkles. You can see that I was drinking twice the amount I drink today. That was probably in 2006, as you can tell because it's not a 4:3 aspect ratio—the picture resolution was still the old one, something like 2024 by 768 or something like that.
00:04:55.339 This was probably my first conference tour, and I was presenting about the 'cells' gem. It's impossible to find the logo that someone created for us back then. People actually created logos for projects they liked! That doesn't happen anymore. If anyone can find the old logo, it was great; it said 'cells' with 'insert awesome slogan here,' and we just kept it that way.
00:05:06.639 So, cells was kind of my first encounter with my style of software architecture and the community. It was a long time ago, as you saw in the photo. The purpose of cells is that you have a web application, and we have HTML views. This was before React and similar technologies.
00:05:22.440 It was about getting HTML fragments, something like a sidebar or a navigation bar, and encapsulating that particular view component. Spoiler alert: you want to model that as a component. So like a sidebar or a nav bar, that’s what I wanted to achieve.
00:05:59.940 What I got from Rails was this partial rendering—you render something like a nav bar partial and pass in the current user or use instance variables. There was really no interface; the partial could access everything, and the partial was in ERB, Slim, or whatever template engine. In that partial, you could call helper methods, which could lead to problems with encapsulation.
00:06:47.880 Therefore, I was asking in the community, 'What's the way of doing this?' Back then, we didn't have real-time chats or GPT-like tools—just mailing lists. People were telling me this is just the way we do it, and I was really frustrated with the answer.
00:07:13.560 Fortunately, I found a small script called 'cells' from Ezra Zigmundovich, who sadly passed away a few years ago. He had this view component code in like 20 lines—really basic stuff—but it was the concept I was looking for. You called 'render cell,' passed in what you wanted the cell to know, and it completely changed my approach.
00:08:03.120 The idea was that the cell was a class; you had object orientation in the view! I could render partials from that class, much like a mini-controller. It looked exactly the same as a partial, but it let me isolate the code and keep everything neat.
00:08:34.740 To illustrate, I still have the Avatar4 in the cell view. That helper was not sitting in a global module; it was actually an instance method within that cell. By isolating the logic in this way, I was able to call multiple Avatar4 implementations without conflicts. It was aesthetically pleasing!
00:09:11.580 Thanks to Ezra's code, I was able to program it. I was still terrible at programming back then, but what I eventually developed was a cell component that could be tested in isolation. You could assert that the HTML was showing the right Avatar and run that cell in any environment.
00:09:36.300 And so, that was my experience with the cells gem. It became a trivial gem, but it was a nightmare making people excited about it because it was an abstraction that many thought they didn’t need.
00:09:54.420 My next adventure involved parsing and serialization—turning something like JSON or XML into a usable format. I hated how deep I had to go to override methods in Rails for serialization.
00:10:06.120 The processing of documents was often so complicated; you had to override as JSON deep within the Rails architecture. This was like a necessary evil, as was the misunderstanding about the parameters structure.
00:10:55.740 So, why did I want to introduce something called 'representer'? I wanted to declare the format of my documents, like title and content for a blog post, and everything that follows. Essentially, you could declare how the objects get transformed into JSON and vice versa.
00:11:21.990 You could run that component in any environment and be guaranteed the same content every time. When it comes to serialization versus parsing, people often focus more on serialization, but parsing is intricate and challenging.
00:12:00.400 In summary, Reform's goal was to provide clear separation between parsing and rendering processes without overriding global methods. This way, everything was encapsulated and testable. The third milestone in the history of Trailblazer was the Reform gem.
00:12:44.580 The goal with Reform was to manage HTML forms effectively with individual validations, debating where this should reside— in the model or a separate class. We concluded it should be in a separate class.
00:13:15.840 Rails encouraged using form builders and automatic parsing in params parser, which turned into a mess. So, the collaboration began, and we had the idea to encapsulate validations within a separate form class.
00:13:51.120 The API roughly looked like instantiating the form and validating incoming parameters only within that form's context. This approach allowed for much more sensible management of form data and validations.
00:14:40.800 I later learned to deprecate items as this process evolved, but having encapsulated forms was crucial in testing layouts without having to touch the entire Rails stack.
00:15:06.420 At this time, as I was writing a book on Trailblazer's concepts, I learned that having things isolated leads to good encapsulation. This realization was pivotal for organizing my thoughts and processes into actionable units.
00:16:06.780 As Trailblazer developed, it started gaining traction. While there were bridges, they often invoked the concept of operations. The idea was to streamline processes within a controller without having all the code crammed in.
00:17:16.560 This concept presented a way to isolate logic from controllers better. The success was in creating isolated tests for operations without the context of the entire framework, pioneering some major steps.
00:18:08.700 As we progressed, there were issues with people pushing all their business logic into the controller or operation commands, leading to convoluted and hard-to-maintain code.
00:19:14.580 We needed a way to introduce operations dynamically, which prompted me to create a service object allowing defining behavior in a structured format through operations.
00:20:00.300 The early stages of Trailblazer requested passing everything through isolated inputs, allowing improvements in approach without losing sight of original objectives.
00:20:57.840 There were also many instances where encapsulation significantly aided clarity and cleanliness; for every new operation added, the previous layers of abstraction helped with context and allowed replacing models.
00:21:56.520 As we demonstrated the model, we sought to shift discussing further states into clear operation maps, deepening the appreciation for stable transitions and gates. Our excitement continued as the complexity only grew.
00:22:53.520 I've been spreading this message as much as possible to showcase that our vision was to compartmentalize logic so anyone could see easily how streams function. All while preserving the advantages of a clean architecture.
00:23:34.320 This allows new contributors to quickly learn the intricacies of Trailblazer without feeling overwhelmed. As I continued discussing where I’d take Trailblazer, I began advertising our next ventures.
00:24:28.920 The vision is apparent, and I reflected on how inner workings of the framework led to Operations becoming more stable while finding the right overhead for maintaining control without creating a tangled mess.
00:25:04.380 Maintaining control over operations was key while preserving steps under a typical coding paradigm within community development. I foresaw how this structure aids less experienced developers in quickly understanding usage.
00:25:55.560 I brought up how these transformed elements improved works in the community while shifting expectations. As I engaged with experiences, it became clear how pivotal encapsulated classes will be going forward.
00:26:43.860 In retrospect, many developers are drawn to lean solutions. While I appreciate their stance, I become irritated when they resist shifts that I know would lead to more productive environments.
00:27:37.020 Still, there remains a challenge to continually reframing problems rather than simply following norms of what others accept. To this end, I Knew adapting was essential but sought awareness that alone was not comprehensive.
00:28:30.240 You all carry varying experiences, and I believe each encounter can be pivotal. Adapting to Trailrunner's methods encourages community growth, where it's less about a professional journey and more a shared collective.
00:29:34.680 My connection to framework emerged through the transformation of operations and how the flow intended to change comes down to clear communication. Overall, I hope to deepen those interactions for greater understanding.
00:30:22.020 As we proceed with the events enabling growth, the goal remains to invite others to witness the progress and potentially share their experiences. Instead of tip-toeing through development, maybe portray results to break out of needless hurdles.
00:31:14.640 I emphasize that connections created through this platform should yield improvements through consistent collaborative operations so each of you may realize long-term benefits moving to the forefront.
00:32:05.640 Navigate carefully through projects and interactions—leading to coherence yields less friction while expecting potential for digestion toward complex outcomes. Remember that understanding fractalizes well when communicated.
00:32:46.920 Finally, I remind those attending gatherings or meet-ups to welcome fresh ideas; trails may take different routes underfoot, yet allow what appears wild to inspire growth that yields reliable frameworks.
00:33:37.020 I eventually reiterate to enjoy discovering new aspects, provoking dialogues which inevitably lead to enrich learning experiences—building communities through knowledge-sharing serves us best.
00:34:40.860 Recognizing your part can seem daunting, but the collective journey inspires courage and keeps us motivated. Look ahead and harness a future of possibilities, as we share invaluable insights emerging from routine practice.
00:35:40.800 Conclude interactions with well-founded strategies while enjoying reactions to achievements that echo back productively from peers. You’re all welcome to explore pathways together.
00:36:20.640 Thank you all for your time and consideration today. Let’s build something great together and continue this shared journey in development. I look forward to connecting with you further.
00:37:00.840 Next, I opened the floor for questions, with my excitement for each attendee being shared directly. While conversations unfolded, I reassured the importance of dialogue spurring engagement and curiosity toward the forthcoming meet-ups.
00:38:15.120 Questions emerged around the limitations of existing paradigm trades, specifically how drawing a comparison yielded opportunities for understanding best applications adjusted cases.
00:39:20.400 My project served as an evolving thread through varied perspectives while seeking to highlight comprehensive behaviors through encapsulation frameworks. In light of these connections, I expressed gratitude to everyone present.
00:40:25.860 As the discussion transmuted into feasible examples, it became apparent that moving through interfaces defined each operation promisingly adhered in great company. I’m heartened by how these structures enhanced methods within programming.
00:41:35.160 Amid inquiries raising specifics, I felt encouraged as we navigated directing queries smoothly from curiosity roots to outcomes valuable through every assertion exhibited.
00:42:57.420 I thank everyone; it’s been an enriching experience discussing code paradigms as they merge with realities of developing responsive platforms together.
00:43:14.160 Finally, I look forward to seeing you at further meet-ups and would love to connect. Enjoy your evening and those delightful beers!
00:44:15.540 If there are any lingering questions, feel free to catch me after this session. Thank you for your hospitality and engagement on this exciting journey!
00:45:06.180 Through these exchanges, knowing I’m here to foster collaborative spaces, let’s close this event's chapter but keep the narrative alive. Each production reflects our commitment to bringing thoughtful progression to innovation through collective engagement.
00:45:56.880 With that, I bid everyone farewell for now. Have a delicious evening; I look forward to forging much deeper ties!
00:46:47.340 Let’s raise the bar, steep it in thoughtful discourse, and promote open communication as we venture further into this coding journey.
00:47:59.520 Finally, I emphasize how every little interaction enhances processes remarkably. Take every chance to learn and help your community grow beyond its current horizons.
00:49:00.960 So, with that said, let’s grab a beer and wind down while having some fun conversations. Cheers to new beginnings tomorrow and every day after that!