Ruby Programming

Summarized using AI

Frustration Driven Development

Evan D. Light • August 16, 2012 • Earth

The video "Frustration Driven Development" by Evan D. Light, delivered at the MountainWest RubyConf 2012, explores the theme of harnessing frustration as a catalyst for improvement within software development. Light shares insights from his career experiences that demonstrate how frustration can motivate developers to make necessary changes in code and project management. Highlights from the presentation include:

  • Embracing Frustration: Light discusses his personal frustrations with software projects and how these emotions can lead to productive change.
  • Anti-Patterns in Code: He introduces key anti-patterns encountered in programming, emphasizing the common pitfalls that frustrate developers.
  • DCI Architecture: Light presents the Data Context Integration (DCI) as a solution to messy user classes that attempt to handle too many responsibilities. He shows how separating concerns can simplify code design.
  • Monkey Patching Cautions: He shares his experiences with monkey patching, advocating against it in favor of dependency injection to avoid potential issues.
  • Importance of Naming Conventions: Light stresses the significance of meaningful naming in code, recommending names that reflect the function and association in the context of the application.
  • Code Structure and Readability: The presenter advocates for horizontal alignment of code and proper use of private methods to enhance readability and maintainability.
  • Life Lessons and Risks: Drawing from his personal life, Light touches on how significant events, such as personal struggles, inform his career decisions. He emphasizes the importance of taking risks when faced with challenges and how these risks can lead to fulfilling experiences.
  • Concluding Wisdom: The takeaway from his talk is a call to action for developers to change their circumstances when frustrated, serve higher ideals, and find fulfillment in their work.

Light concludes with a motivational note urging listeners to embrace change in both their professional and personal lives as a means to foster growth and satisfaction.

Frustration Driven Development
Evan D. Light • August 16, 2012 • Earth

Everyone draws inspiration and motivation from different sources.

For most, it's often frustration.

We make life decisions, define new features, or refactor code when we get too annoyed by current circumstances. This is where I admit that I have a low tolerance for frustration. Having been frustrated a great deal during my career, I'm going to discuss several anti-patterns that I've seen in code and how to use the Dark Side of the Force (frustration, anger, and rage) to escape from them.

MountainWest RubyConf 2012

00:00:15.240 Well, for those of you who are left, I guess I’m the only person keeping you from dinner. So, for those of you who are still here, thank you. For those of you who are still watching, let me turn off some things before we begin.
00:00:22.000 This presentation is rated M for Mountain; not G. It will be a little bit mature. There aren't going to be any sexual themes or intense violence. Well, okay, there might be some yelling. I won't guarantee there won't be strong language, and if anyone wants to get me some whiskey, I’d appreciate it. However, there won’t be any alcohol on stage, sadly.
00:00:36.040 So, this is me. I'm a freelancer. Hire me! I don’t break screens like Dave does. This is how I look on a daily basis when I’m working. For those of you who don’t know, this is the Dalai Lama. He tends to be one of the more peaceful and happy people in the world.
00:00:57.720 Sadly, this is usually how I feel—angry, bitter, and frustrated with the world, code, clients, everything. How did I get here? I’m not so sure either. So, I started this presentation to address that. Thirteen years of contracting with the federal government probably drives anyone insane. The government is really good at wasting your tax dollars and starting projects that don’t finish. Most of the software projects, including government projects, are failures.
00:01:41.680 I've bounced in and out of startup land; I’ve been through two bubbles. Yeah, that’s where the gray hair comes from—at least, some of it. Lately, I’ve been working for myself as a freelancer, which brings its own special kind of stress: paperwork, taxes, all that good stuff. I’ve been doing this for about 16 years and have seen a lot of crap in my job. I’ve noticed a lot of projects that do bad things.
00:02:28.720 I tend to get a lot of rescue projects lately, which means I see a lot of things that people have done wrong. I make mistakes myself occasionally, of course, but it definitely pisses me off. If you remember from one of those movies, there’s a line about how fear leads to anger, anger leads to hate, and hate leads to suffering. Let's talk about hate.
00:03:09.040 I found this image and fell in love with it instantly. The comments hit home too. I hate writing presentations and giving them; I really don’t enjoy writing. So this time, I started mind mapping—I whipped out my mind map app on my iPad and jotted down everything that came to mind that frustrated me about software projects.
00:03:54.800 I’ll talk a bit about anti-patterns. Starting out with a new project can be difficult. Sometimes, you don’t know where to begin. If you’re good at what you do, you might just start writing down what has to be done—what we call pending specs. This leads to building from there.
00:04:25.240 On a personal note, my mother-in-law drives me crazy, and that’s how she got into this presentation. I was mind mapping one day while my mother-in-law walked in and started talking to my wife. I thought, why not write some thoughts next to that? I started to feel better, realizing this presentation might be therapeutic for me. Hopefully, it will also be entertaining and informative for you.
00:05:20.560 I want to show some code that metaphorically relates to my mother-in-law. The user class, typical in software, tries to do everything because the user is seen as the one pushing the buttons. This means including all sorts of behaviors and associations, which doesn’t add any real value. It's just moving code around without improvement. I was introduced to a solution called DCI, which stands for Data Context Integration.
00:06:12.360 Let’s take a look at some code I’ve worked with on a Ruby project. This code is something that receives a response from GitHub when a user authenticates and wants to create an account. We have a session controller calling a method and subsequently extending the user with a new user provisioner module, which is essentially a role that includes the provisioning method.
00:06:53.760 This way, the user class remains clean, and our controller is contextual, allowing us to see that we are provisioning a new user. However, there might be some downsides to this approach. I've heard concerns about performance, especially regarding method caching and object persistence in Rails. If you’re not careful, you can blow away method caches, which leads to performance issues.
00:07:56.920 Now, let’s touch on monkey patching. This has caused me considerable pain recently. There was a gem where the author wanted to add behavior to a rescue method and ended up monkey patching it, which created tons of issues. The solution is simple: don’t monkey patch! Instead, try using dependency injection.
00:08:58.760 I know it might sound scary, but it’s not inherently a Java problem. If a dependent method doesn’t exist in the gem, we can simply add it. Using GitHub for pull requests makes this feasible, and it allows us to expose the behavior we need without unnecessary struggles.
00:09:50.000 Now, let’s discuss naming conventions. Anyone who creates a class that associates two things should consider the names carefully. If you have a user and a team, don't call it user_team; call it something meaningful like team_membership instead. Good naming reflects what the associations do and helps others understand the code better.
00:10:44.240 Additionally, while it may be tempting to use vertical code for readability, horizontally aligned code is generally harder to follow. Adding carriage returns can make code segments easier to navigate. As for personal experiences, anyone can be insensitive at times and say whatever comes to mind without considering others' feelings. It's important to remember that when working in teams, empathy is key.
00:11:56.600 Returning to conventions in coding, take a note from Yehuda's talk on Ruby conventions. Conventions help ease the burden of understanding someone else’s code. If people stray from typically accepted patterns, it creates a mess and confusion. Boring, conventional code is favorable because it contributes to readability and maintainability.
00:12:38.520 We need to use meaningful vocabulary; if you associate two classes, don’t simply match their names but reflect on the action being taken. For a user belonging to a team, a proper name would be team_membership instead of user_team. This attention to naming clarifies the code’s purpose.
00:13:11.440 In terms of handling messy code, it's beneficial to keep bad implementations out of high-level classes. Instead, confine the chaos to private methods or helper classes with comments to indicate the presence of less tidy logic. This way, you’ll avoid landmines when reading through the code.
00:14:58.920 Finally, let’s talk about significant life experiences. Coming out of college, many expect programming to be an adventure. However, the reality often consists of managing schedules, budgets, and workflows that lead to stress. Life and work can be immensely challenging.
00:15:50.000 It helps to pause and reflect on pain points in life. When you feel overwhelmed, consider your purpose and the ideals you serve. We all serve something, whether that’s your job, an organization, or your family. Each one of us has passion towards our work, which explains our presence here.
00:16:44.000 During tough times in my life, I wanted to take risks instead of continuing with the status quo. For instance, eight years ago, I faced significant challenges related to my wife’s health. Diagnosed with Huntington’s disease, the prospect of family and my future became uncertain.
00:17:54.640 Despite that, I didn’t give up. After attending a conference, I was inspired by others who had prevailed through their difficulties, and I decided to change my life. Making changes added more happiness into my life, and overall, I became much better off.
00:19:01.760 Today, my life is still complicated. My wife’s illness is ongoing, and we face new challenges as a family. However, I look back and realize that taking the leap to change my circumstances ultimately ted to a healthier and more fulfilling lifestyle. Anyone can do the same; when life pushes hard, don’t be afraid to jump off the cliff. Take calculated risks.
00:20:09.240 I hope that by sharing this, it may inspire someone who finds themselves down. Remember, it's about serving higher ideals and living life authentically.
00:20:19.480 If you don’t like your current situation, change it! That’s the essence of what I hope you take away from my talk today. Thank you for listening.
00:21:05.240 Keep flying, and stay shiny!
00:21:57.520 Anyone have any questions? No? That’s alright. It’s all good. Just remember, if anyone needs to talk or have inquiries about anything specific, feel free.
Explore all talks recorded at MountainWest RubyConf 2012
+11