Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
RubyConf 2018 - Make Ruby Write Your Code for You by Alex Stephen Despite best intentions, sometimes you just have to write similar code over and over again. This leads to a massive maintenance burden down the road. But, there’s a better way: have the computer write the code for you. Code generators are shrouded in mystery and can sound unapproachable, but they aren’t! I’ll show you how code generation is no different than web development and why Ruby has all of the tools to build one quickly. You’ll leave this talk knowing where you could apply code generation in your own code base and how to get started!
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the talk "Make Ruby Write Your Code for You" presented at RubyConf 2018, Alex Stephen discusses the concept of code generation using Ruby, emphasizing its practical applications in software development. He begins by introducing his background at Google Cloud, where he and his team tackled repetitive coding tasks that resulted in maintenance burdens. To address this, they developed a code generator called Magic Modules, which automates the writing of code based on templates and a word bank of parameters. The talk elucidates the principles behind this code generation process, making it more accessible to developers. Key points discussed include: - **The Problem of Code Duplication**: Repeatedly writing similar code for different features can lead to excessive technical debt. - **Understanding Auto-Generation**: Rather than being intimidating, auto-generation is about instructing the computer to write code based on defined parameters. This concept is likened to creating Mad Libs—using templates that get filled in to produce dynamic code. - **Templates and Word Banks**: Effective code generation relies on creating templates that resemble Ruby code, utilizing a 'word bank' of key values. ERB (Embedded Ruby) is introduced as a powerful library for this purpose, allowing for simple and effective template creation. - **Implementation in Practice**: The speaker provides a practical analogy of ordering pizzas through Ruby code to illustrate how auto-generation helps manage complexity and enhance code maintenance. - **When to Use Auto-Generation**: Stephen advises evaluating new features for similarities to existing code to discern if auto-generation is a suitable approach. - **Structuring the Word Bank**: YAML is suggested as a format for creating the word bank, facilitating easier object creation and management. In conclusion, Stephen's presentation offers a compelling argument for utilizing code generation as a means to simplify code writing processes and reduce maintenance burdens, making it an accessible tool for Ruby developers. He encourages the audience to be innovative in their use of these techniques as a way to streamline development workflows. The talk wraps up with a call to explore the Magic Modules project on GitHub and connect with him on social platforms to further the discussion.
Suggest modifications
Cancel