Dependency Injection

Summarized using AI

Double Click to Wow

Evan Phoenix • September 04, 2008 • Earth

In the keynote "Double Click to Wow" presented by Evan Phoenix at the LoneStarRuby Conf 2008, the speaker provides an engaging exploration of the Ruby community's history and cultural dynamics, highlighting both its innovative spirit and the humorous memes that shape it. Phoenix, who is the lead developer for Rubinius, shifts the focus from technical discussions about Rubinius to the quirky moments in Ruby's evolution and community interactions.

Key points discussed in the video include:
- The Influence of Java Developers: Phoenix reflects on the influx of Java developers in the Ruby community around 2004, leading to the brief trend of adopting dependency injection, which was ultimately rejected due to Ruby’s inherent dynamic resolution capabilities.
- Naming Conventions: A lively debate within the community over the terminology for Ruby constructs, such as meta-class versus singleton class, illustrates the Ruby community's playful approach to language and meaning.
- Singleton Pattern Critique: The speaker critiques the singleton pattern, arguing that while it often complicates testing, Ruby's flexibility allows for effective alternatives without strict limitations on instance creation.
- Popularity of Git and Cultural Memes: Phoenix discusses the transition from SVN to Git in the Ruby community, marking a significant shift in collaborative practices, alongside the humorous ‘chunky bacon’ meme from the Poignant Guide, which showcases the light-hearted creativity within the community.
- Performance and Misconceptions: The speaker addresses common concerns about Ruby's performance, emphasizing the need for context in discussions about scaling and efficiency, as poor coding practices can exploit any language's limitations.
- RubyGems' Importance: The RubyGems system is highlighted as critical for package management, underscoring its role in facilitating new developer integration and fostering an ecosystem of innovation through domain-specific languages (DSLs).
- Metaprogramming Balance: Phoenix warns against excessive use of metaprogramming, advocating for a balanced approach that respects traditional coding principles while embracing Ruby's expressive capabilities.

The talk concludes with a celebration of the Ruby community's commitment to craftsmanship, humor, and mutual growth, inviting attendees to engage further with these themes. The essence of the community, as presented by Phoenix, lies in its agile nature, embracing both serious craft and light-hearted meme culture that together fuel collaborative advancements in Ruby development.

Double Click to Wow
Evan Phoenix • September 04, 2008 • Earth

Double Click to Wow by: Evan Phoenix

LoneStarRuby Conf 2008

00:00:06.359 Video equipment rental costs were paid for by PeepCode.
00:00:19.279 Hello, my name is Evan Phoenix, and I work for Engine Yard as the lead developer for Rubinius. Jim asked me to come here and give a little keynote.
00:00:38.920 I thought about it for a while. I'm a big procrastinator, so I was working on the last bit of the slides today. Since this is a fairly short talk, I decided that I wouldn't talk about Rubinius. However, if anyone wants to discuss Rubinius, I'd be happy to do so later. Tonight, in the next half an hour, I want to talk about something a little more fun. It would work really well if everyone had a beer in hand, but that's okay. I'm going to talk about fun moments in Ruby community history, which I find really interesting.
00:01:19.040 The Ruby community loves memes, and you'll often see someone mention something, which creates this almost avalanche effect where everyone tries out the same thing. This results in rapid and widespread adoption, and people really start to have fun with it. But what is a meme after all? It's an element of a cultural system or behavior that may be passed from one individual to another by non-tic means.
00:01:39.960 Now, this is not that kind of conference, so we won't be discussing sharing techniques in that way. Nonetheless, the idea is that this information spreads really quickly, and the Ruby community is particularly fun to observe in this regard—how these things are discussed. I also want to touch a bit on history, as I think it's just fun to provide some background. So, let's do a little test here: who has been programming in Ruby for at least a year? Raise your hand. Okay, great! How about two years? Three years? Four? Five? Six? Fantastic!
00:02:29.160 Looking around, it seems that most of you started programming in Ruby around 2004 or 2005, which works perfectly for my discussion. Around that time, we saw an influx of Java programmers joining the Ruby community. This wave was seen somewhat negatively, as they were perceived as a 'barbarian horde' by the rest of the community. One interesting thing they brought with them was the concept of dependency injection.
00:03:00.680 We went through a period that I like to call the 'dependency injection rash.' Beginning around 2004, as I mentioned, we had a significant influx of Java developers who were accustomed to using tools like Spring for dependency injection. The concept seemed sound—decoupling relationships to create more modular code was appealing because it allowed for flexibility in the code to adapt to future changes.
00:03:56.680 However, this shift meant that many started to believe that Ruby needed a dependency injection framework. For a couple of years, everyone was really focused on this topic, especially during the first six months of the trend. People like Jamus Buck even wrote multiple frameworks during this time. The community thought that if dependency injection was useful in Java, then it should definitely work in Ruby, too.
00:06:15.320 However, as more people considered the concept, they began to realize that dependency injection wasn't as useful for Ruby as they initially thought. The concept fundamentally relies on dynamic resolution, which turned out to be something Ruby does naturally with late binding. Ruby's dynamic nature made dependency injection feel unnecessary. Ultimately, many Ruby programmers had already been using this form of dynamic resolution since the beginning.
00:06:56.960 To illustrate this, let me give you a quick example. You can easily create a class that does some work, while delaying the exact method definition until you need it. In this way, you are already achieving what dependency injection sets out to do without the need for a separate framework. People looked at the simplicity and beauty of Ruby and thought, 'Why complicate things with additional frameworks?'
00:08:17.480 To this day, dependency injection frameworks are rarely used in Ruby, and it's fascinating to reflect on how the community evaluated and rejected outside ideas. Programmers often have a poor reputation for ignoring historical outcomes, so it's essential to remember that we tried and largely abandoned dependency injection in Ruby.
00:09:24.320 Next, I’d like to explore another meme that intrigues me. How many of you are familiar with the debate over naming certain Ruby constructs? Let's see a show of hands—who refers to this construct as a meta-class? Or a singleton class? Or an eigenclass? This ongoing debate on terminology within the Ruby community serves as a fun lens to understand our language—and it exhibits how we attempt to define the Ruby constructs.
00:10:09.440 Interestingly, in Rubinius, there is a concept known as a meta-class. However, it is crucial to remember that you shouldn't feel obliged to use my terminology. While we're on the subject of memes, I want to rant a little bit about a certain prevalent trend. Let's take a moment and look at the classic definition of a class—a category or set of things having properties or attributes that differentiate one kind from another. For example, think of a class hierarchy like organisms, mammals, felines, and house cats.
00:11:29.240 Although these examples seem straightforward, the Ruby community has taken liberties with naming conventions that can lead to confusion. For example, when we categorize classes, the use of terms like 'base' can lead to ambiguity. Are we making a class called 'Base' for a military base? The takeaway is that naming has significant implications, and developers should care about how they define their classes.
00:12:57.760 Another thing I want to address is the singleton pattern. This pattern has often been brought into our community by Java developers—the Highlander syndrome, if you will. The common understanding is there can only be one instance of a class. But do you really need only one? More often than not, different models can benefit from multiple instances.
00:13:40.000 The important thing to recognize is that the singleton pattern can complicate testing in Ruby. The use of the singleton has been debated a lot, with many developers concluding that they wanted reusability without necessarily limiting themselves to one instance.
00:14:57.240 To simplify implementation, we afforded ourselves a different perspective by creating a simple contract in Ruby for instances. This led to a simplified way to create singletons in Ruby without requiring additional libraries, which showed how powerful Ruby's expressiveness can be. Many of these ideas can seem all-or-nothing, but Ruby allows for flexibility in how we implement functionality.
00:16:42.320 The same can be said about aspect-oriented programming, which has seen various attempts at implementation in Ruby, often leading to mixed results. While the idea of aspect-oriented programming can seem appealing, Ruby's existing metaprogramming capabilities negate the need for strict implementations.
00:17:12.000 Over the years, we’ve seen the rise of prominent figures in the Ruby community, such as why, whose mysterious presence fuels discussions and theories at every Ruby conference. He does something, then disappears, and his self-portrait from 2006 gives just a glimpse of who he is. It's amusing to think about how much more we know about his code than about him as a person.
00:18:27.000 Moving on, let’s discuss the amusing 'chunky bacon' meme from the Poignant Guide. It’s a humorous representation of the community's light-heartedness and creativity. This quirky meme showcases how humor can easily blend into programming culture, reinforcing the friendships and connections among developers.
00:19:07.240 In contrast, we have personalities like Zed Shaw, who maintain a strong presence and voice in the community. The balance of quiet contributors versus vocal advocates adds a multifaceted layer to the Ruby culture.
00:19:50.040 On a technical note, Git has emerged as a standout meme in recent years. When we transitioned to Git from SVN, we observed widespread acceptance across the community. Its rise illustrates how Ruby developers are not afraid to adopt new technologies and creative ways of working together.
00:20:44.600 However, along the way, we've also had our fair share of debates regarding performance. Complaints about Ruby being too slow often arise, but it’s crucial to examine the context behind these claims. Programmers are often quick to blame the language while neglecting to recognize that poor coding practices can lead to inefficiencies.
00:21:55.880 The discussion regarding operating systems and hardware isn't exclusive to the Ruby community. Notably, the Ruby community has shared a unique bond with Macs, leading to humorous scenarios like the 2006 RailsConf's issuance of non-conformist certificates to those without a Macintosh.
00:22:58.160 Concerns over Rails not being able to scale have been a common refrain, often echoed without substantial basis. General claims that 'X can't scale' have recurred throughout tech history. Naturally, it's possible to write poor code in any language, so careful attention to building efficient systems benefits any development.
00:24:34.520 The legendary Pickaxe book has also proven vital in shaping Ruby's popularity in the United States, with most early developers learning about Ruby through that essential resource. Although many continue to discuss Ruby's evolution, the RubyGems system is something that is often taken for granted.
00:26:03.720 Notably, RubyGems showcases the Ruby community's ability to vet solutions and maintain an effective infrastructure for package management. This has allowed new developers to jumpstart their Ruby experience and connect with established practices.
00:27:09.480 Lastly, we must acknowledge the creative explosion of ideas that often leads to a pipeline of new gems and frameworks within the Ruby ecosystem. The practice of developing domain-specific languages (DSLs) has particularly flourished, sparking innovative tools and frameworks across the community.
00:28:15.240 This trend toward DSLs showcases the Ruby community's desire for flexibility and expressiveness, allowing for push-and-pull discussions that cultivate growth and adaptation. Even within the sphere of Behavior Driven Development (BDD), a wide array of DSLs have developed, providing Ruby developers with choices that fit their specific needs and preferences.
00:29:42.480 As we discuss the importance of metaprogramming in Ruby, we must guard against overdoing it. While metaprogramming can enable impressive feats, it's crucial to thoughtfully approach and recognize when conventional methods are more effective.
00:30:49.200 The essence of the Ruby community lies in its commitment to enjoying the craft of programming while celebrating the infusion of humor and camaraderie. The ongoing pursuit of excellence spurs friendly competition, resulting in vibrant growth for all involved. The community should remain agile to exotic ideas without losing sight of its core values.
00:32:18.080 Thanks for joining me in this exploration of Ruby history and community culture. If you have any questions or comments, feel free to share.
00:33:37.760 The discussion around the RPA and RubyGems exemplifies how collaboration and criticism can lead to meaningful advancements. While some differences may seem subtle, they helped shape the community's perception and approach to package management. Ultimately, both systems contributed to the growth of Ruby as a language.
00:34:04.000 Thank you!
Explore all talks recorded at LoneStarRuby Conf 2008
+18