RubyConf AU 2020

Summarized using AI

Tales From The Ruby Grimoire

Brandon Weaver • February 20, 2020 • Earth

Tales From The Ruby Grimoire is a captivating presentation by Brandon Weaver at RubyConf AU 2020, where he explores the depths of the Ruby programming language through a whimsical narrative. The talk introduces the character Red, a curious lemur who discovers the secrets of the Ruby Grimoire, a source of dark and powerful knowledge in Ruby programming. Throughout the presentation, Brandon intertwines storytelling with technical concepts, making complex ideas accessible and enjoyable.

Key Points Discussed:
- Character Introduction: Red, a mischievous lemur, embarks on a journey to uncover the mysteries of Ruby, guided by his master Scarlet.
- The Forbidden Knowledge: Red's quest leads him to the Ruby Grimoire, a powerful book that unlocks various programming concepts but also poses significant risks.
- Diverse Programming Languages: The talk highlights insights from other programming languages like Scala, JavaScript, and Haskell, drawing parallels and lessons that can be applied in Ruby.
- Scala: Introduced the concept of placeholder arguments, explaining how flexible and artistic programming can enhance Ruby's capabilities.
- JavaScript: Showcased the art of destructuring and punning, emphasizing its effects on object manipulation and function design.
- Haskell: Explored 'lenses,' a technique for navigating complex data structures without mutations, inspiring new ways to approach problems in Ruby.
- Metaprogramming: Discussed the possibly dark nature of metaprogramming, emphasizing the balance between creativity and clarity in programming.
- Engagement with Creativity: Brandon encourages the audience to view programming as both a challenging science and an art form, recognizing the joys and potential pitfalls.

Brandon concludes by urging the audience to embrace the creativity of programming, highlighting the costs associated with such magical knowledge but also the immense rewards for those willing to explore. The narrative reflects a playful approach to learning Ruby, engaging the audience with the charm of stories and playful analogies, which keeps the complexities of programming exciting and relatable. Takeaways from the talk include a deeper understanding of Ruby's potential, encouragement to explore beyond the confines of conventional programming, and recognition of the whimsical side of development, all while valuing the power and responsibility that accompany advanced programming techniques.

Tales From The Ruby Grimoire
Brandon Weaver • February 20, 2020 • Earth

Brandon Weaver

There are arts best left unspoken, black magicks left forgotten and locked away in the deepest vaults of the Ruby language, lest they be seen by mortal eyes not ready for the horrors inside.
That is, until a particularly curious Lemur named Red happened to open it. Journey with Red into the Tales of the Ruby Grimoire, through parts of the language not meant for the faint of heart.
There is great power here, but that power comes at a cost. Are you willing to pay it?

Brandon is a Ruby Architect at Square working on the Frameworks team, defining standards for Ruby across the company. He's an artist who turned programmer who had a crazy idea to teach programming with cartoon lemurs and whimsy.

Produced by NDV: https://youtube.com/channel/UCQ7dFBzZGlBvtU2hCecsBBg?sub_confirmation=1

#ruby #rubyconf #rubyconfau #rubyconf_au #rails #programming

Thu Feb 20 14:50:00 2020 at Plenary Room

RubyConf AU 2020

00:00:00.030 Our next speaker, Brandon Weaver, is not just a very snappy dresser, but also a Ruby lover. He is an equally rich source of puns, lemurs, music, and art. His talks are a real treat, bringing together a variety of fascinating elements. The first time I saw him speak was at RubyConf in the States, and it was a great experience. I'm so excited he's here today.
00:00:12.179 Brandon is a Ruby infrastructure and frameworks engineer at Square and has traveled here from Oakland, California. In his talk, he will share some tales from the Ruby Grimoire. So, without further ado, let's welcome Brandon!
00:01:05.070 It's lovely to be here! I had a little bit too much fun preparing for this. Someone mentioned wearing a tuxedo, but unfortunately, I didn't have time. So, you'll have to deal with this outfit.
00:01:10.460 Now, who exactly am I? This is a very fun question! I am an artist who eventually became a developer through a series of fortunate mishaps. It all started when I was told to try web design to earn a bit more money and make myself more marketable. Then, someone suggested I learn a little JavaScript, so I did.
00:01:33.640 Before I knew it, I had some clients, and the journey took off from there. Things went downhill fairly quickly after that, and soon I found myself working as a Ruby engineer on frameworks and language architecture at a place called Square. So, if you want to know more about that, feel free to ask me later.
00:02:00.120 But that's not why we are here today. We're here for a story—and I love a good story! I brought one of my favorites today, so shall we get started?
00:02:21.280 Our story begins with young Red and his master, Scarlet. You see, Red was studying diligently when his master Scarlet told him that the Council of 3.0 had been called. She would be gone for a bit to debate the merits of keyword arguments and deprecations.
00:02:30.910 Scarlet warned Red to be sure to study, as she would have a special test upon her return. With that, Scarlet departed. Now, Red was a mischievous little lemur. He made sure that Scarlet had indeed left before he had some special ideas.
00:02:50.260 You see, in the castle where master Scarlet resided, there were secrets. Forbidden corridors and libraries held knowledge untold, knowledge not seen for generations. Red was determined to find some of that knowledge. So, he ventured down and down into the depths of the castle, down the staircases into the darkest corridors.
00:03:10.840 There, at the bottom, he found it: a massive door, wrought from steel and locked tightly. Red had often dreamed about opening that door and discovering the great and terrible knowledge that lay beyond it. Perhaps even the secret to finally becoming a senior developer! With that power, studying could be a thing of the past. Masters don't study, right?
00:03:42.180 But the door opened. It had touches inviting him in; surely this was a sign of divine providence! So, he entered, and in that hall, he found a vast library, the likes of which were unmatched in the land of lemurs, dwarfing even the grandest city libraries. Mastering knowledge beyond comprehension, he was overwhelmed.
00:04:00.120 In the center, he saw it: a book of legends, a grimoire of infinite power and possibilities. It was a dark manuscript that contained horrors and wisdom far beyond the capacity of a normal lemur. But Red was no ordinary lemur, so this was absolutely fine. He felt triumphant.
00:04:30.630 He opened the book, but the words on the pages were strange. He couldn't understand a thing. However, Red was not going to be deterred. He had tricks for reading this type of text; he was close enough to the knowledge. No, no, the knowledge would be his!
00:04:49.540 But then something changed. The room slowly grew suffocating as the words began to fade into the paper, disappearing before his eyes. The fog started to glow an angry red, and a phrase appeared: 'Welcome to the Ruby Grimoire, and thank you for freeing me.' What did it mean—free?
00:05:19.680 'Behold the Dark Lord Crimson,' the pages wrote in reply. Red looked up to see a malignant being cloaked in swirling red fog. The Dark Lord Crimson was free, and all Red could do was scream. Well, for a moment, at least, until the fog quelled.
00:05:31.260 You see, I like whimsical fun stories. This is very fun, though a bit scary! So let's get back to the matter at hand, shall we? Keep it down, no need to be rude! I can't see anything with that light.
00:06:01.620 It's been quite a while since I last visited here,' the Dark Lord said. Red stared back in stupefied horror. 'Ah, the grimoire! Oh, how long it has been since anyone strong enough to open it has arrived!' The Dark Lord continued, 'Sit down, sit down! Welcome!' So many possibilities indeed! What lessons shall we learn?
00:06:19.529 So many tales from lands beyond the realm of Ruby await us! But I must ask you, young one, are you willing to pay the price for that knowledge?' Poor, poor Red started to nod vigorously, transfixed. He saw knowledge beyond him, and all of it could soon be his, no matter the cost!
00:06:52.120 The true nature of the grimoire is a journal of my journeys into the lands beyond Ruby. I met several wise sages there, more experienced than I had ever seen before. If all the tales are to be told about all the programming languages I encountered, we shall start with three, and perhaps some of my personal favorites.
00:07:04.770 Let us begin with the tales of the lemurs of Scala, JavaScript, and Haskell, each bearing distinct knowledge. In Scala, the lemurs wear conical hats that reach the heavens, cloaked in robes that change color as often as they switch their programming styles.
00:07:28.800 While Ruby possesses flexibility, Scala has even more! The lessons we can learn from them provide insights into these flexibilities, which bring their own artistic enclosures, like a spell known as placeholder arguments. Placeholder arguments are where an underscore can act as a shorthand for the arguments in a function.
00:08:03.600 So, in Scala, it might look something like this. But what if we could learn how to use this placeholder style in Ruby as well? Before we can learn the tricks, we'll need to cover a few essential lessons. First, we should know about closures.
00:08:19.370 Let's consider a function that takes an argument 'a' and returns another function that takes an argument 'b.' The outer function here takes a value 'a' and returns a new function that takes in 'b.' The interesting part about this is that 'a' is visible in the inner function, meaning that the function remembers its contextual value.
00:08:46.650 This is a closure, as it preserves the context in which it was defined. So, if we call this 'add' function with the value '1', we get a new function that remembers 'a' was '1.' Therefore, calling it with the value '2' returns '3,' because it remembers that '1'.
00:09:11.430 This concept can also be applied using Ruby's map function, which allows us to create lists. We may also define this directly in an inline fashion if we wish. However, for clarity, we will prefer more explicit variants for now.
00:09:33.240 Now, how does the '+' operator in Ruby function? Let’s take a closer look. The addition operation is essentially a method call and looks similarly to C code. However, let's take a moment to clarify and set aside the technical details.
00:09:55.500 With the tricks we've learned, we have enough to create our own placeholder arguments! It just requires a bit more Ruby magic. We can frame our own class, naming it 'PR', as it's shorter, to define placeholder arguments. Imagine how much fun that could be!
00:10:30.620 Suppose we define operators on the singleton class; there’s nothing in the rules preventing it. So, we can explore the realm of possibilities that arise from this. We might redefine the underscore in Ruby, which could lead to a variety of outcomes.
00:10:53.360 But let's imagine we could write more operators, utilizing existing methods such as 'missing' or 'respond_to'. The scope of exploration here could allow us to create incredibly fun experiences using Ruby's flexibility!
00:11:15.780 Now, our discussion centers on whether such explorations could be considered 'dark magic.' It might feel like we're doing mischievous things with a language for the fun of it. But some might say that exploring potentialities is simply engaging with the art of programming.
00:11:42.580 Red nodded along, listening. 'The Lemurs of JavaScript' are a fascinating group! In my journeys, I encountered JavaScript lemurs—masters of their language with colorful accessories and designs. These designs allow them to communicate differently and even alter the language they use.
00:12:17.820 In JavaScript, there's an art known as destructuring, which allows values to be extracted from objects by their names. For instance, if we have a function to move north, this function can add one to the y-coordinate. Inside it, we can extract both x and y values from the object passed to it.
00:12:44.490 Now, there is another magic in JavaScript called punning, a technique I have yet to emulate, even though I'd love to explore it. Punning allows creating new objects while retaining some values unchanged!
00:13:00.750 Here's a quick example: if we wanted to destructure in Ruby, we should first extract parameters from a proc or lambda. This involves a function that maps through the parameters, allowing us to access each argument's names.
00:13:34.680 If we had a function called FN, we could map the parameters and return an array of pairs. For example, if we map it with given arguments 'x' and 'y,' we would get both of those names back. This insight enables us to pull values from structs and utilize them in our code.
00:13:57.600 So let’s say we have a point representing an origin at (0,0). We'll create a method called 'structure' that will accept an object (the origin) and a block. The first step involves obtaining the argument names from the block function.
00:14:21.630 This way, we can use 'map' to access the values we seek—ultimately extracting values of x and y to run computations with them later! By constructing a new function based on what we've learned, we can create a simple point structure with added functions.
00:14:49.430 Within that function, we use our values, and when we return, we can indeed create a point, adding a one to whatever coordinate we need! See how much fun all this programming can be? However, we might run into Haskell.
00:15:10.660 Now, I have one last lesson— the wise sages of Haskell bring forth knowledge that can be quite fascinating! They demonstrate how to focus on deeply nested data structures without mutating them.
00:15:32.490 While trying to understand this idea of lenses—they are capable of showing you or changing a certain part of your data structure—my aim is to break it down into simpler terms so we can all grasp it.
00:15:54.610 Lenses allow us to focus on parts of a highly nested data structure without mutating it. It’s a profound concept, yet initially confusing, but we can explore it together!
00:16:09.410 To illustrate, if we take a structure that contains an atom and a point, we can create functions that will navigate through that structure while making precise changes at corresponding locations.
00:16:25.800 So, let’s consider we have a nested structure with an atom containing a point. We can create a function 'move' that encapsulates our understanding of the atom, moving it upwards by one unit.
00:16:49.610 How does this work? By applying the lenses, we reach into the structure and modify without causing mutation directly. The process unfolds with layers of complexity that tempt us to explore deeper.
00:17:09.880 Now the metadata involves path traversing. To set new values in nested structures, we need to be positioned right above them in the hierarchy, necessitating a careful ‘dig’ to the appointed location.
00:17:36.290 As we venture through these ideas, we discover the potential behind manipulating larger objects dynamically. It’s the core of functional programming, enhanced in Ruby, with capacities like destructuring and manipulation through methods.
00:18:00.660 So, let’s entertain the idea of modifying each key in that nested hash, incrementing every value. The prospects stretch as we traverse through those keys, learning and retuning their values dynamically!
00:18:22.630 However, it’s essential to reiterate that this journey has its costs. Though rewarding, the usage of such magics competes with the clarity of conventional programming.
00:18:57.970 Indeed, one needs discretion and wisdom when adopting these methods, primarily because what can flourish in one context may be perilous in another.
00:19:15.700 Now, moving along, we suddenly find ourselves back in the realm of Ruby with Red contemplating the concepts of evil as he associates with certain programming techniques.
00:19:29.010 Is metaprogramming a form of darkness? Does the power of dynamic programming bear a sinister weight? Or might it simply be a matter of perspective? Red pondered this while continuing on his adventure.
00:19:51.830 Now, let’s address the lemurs of Haskell! They are wise sages, descending from their ivory towers, bringing knowledge that can shake the very foundations of our programming paradigms. The art of lenses allows one to focus on something directly.
00:20:16.740 Though I may not yet fully comprehend those skills, they are truly inspiring! Essentially, these lenses provide visibility and manipulation definitively without changing the state of the data—an abstract yet profoundly useful concept.
00:20:43.510 So let's define a point containing an x-y coordinate and discuss how to manipulate that! Putting forth a function to adjust these points shall allow us to apply our knowledge practically.
00:21:01.190 Now, what is even more exciting is deducing new values from transformations prompted by contact with those lenses! This is where creativity commences; as we navigate the landscapes of programming, new forms emerge.
00:21:27.470 Returning to our earlier definitions, we realize how Ruby encapsulates many of these functions, from deeply nested data retrieval and manipulation through core methods.
00:21:55.300 The imagined potential of paths to achieve that manipulation is exhilarating! As one follows along, traversing through these definitions, one finds surprising simplicity!
00:22:21.600 We visualize structures to interact with complex entities effectively, transforming the relationships and points of focus through simple mappings and function actions.
00:22:45.660 As we move deeper into the conversation about magic and knowledge beyond the languages, consider the gems to be discovered. Language constructs hold the means to breakthrough programming challenges!
00:23:12.440 Now, wrapping up, I want you to absorb the importance of knowledge and understanding. We can look towards the horizon, filled with stories contained within the grimoire, and realize what we create every day can be magic!
00:23:38.100 The tales about programming consist of journeys and destinies paved by countless explorations. We stand just before the categories that distinguish adventure from despair—engage with creativity and imagination!
00:24:05.240 Your questions matter! The charmed porches we enter invite our engagement toward vibrant learning experiences. There stands a soon to be revealed world for us!
00:24:31.100 Let’s encourage the enrichment of Ruby and its characters by sharing enthusiasm through your explorations! The whimsy and charm of Ruby's essence lie at your fingertips so embrace it!
00:24:55.400 Take this moment to recognize we are all trying to grow within the confines of our world, and adopt this respectful engagement with one another as the horizons burst wide!
00:25:17.150 The magic of programming has its costs, yet the rewards could exaggerate limits if we learn to wield it wisely! Design and create smartly and prudently, ultimately recognizing the bounds of truth and depth!
00:25:45.050 I hope you’ve enjoyed this journey into the Ruby Grimoire. The world beyond your screens has stories—a perspective of whimsy and delight! Thank you for sharing this time!
Explore all talks recorded at RubyConf AU 2020
+15