Ruby
The How and Why of Ruby
Summarized using AI

The How and Why of Ruby

by Matthew Clark

The video titled "The How and Why of Ruby" by Matthew Clark discusses the merits of Ruby as a programming language, particularly as a first language for new programmers. Clark, a partner in a coding school focused on Ruby, emphasizes that despite Ruby's flexibility and extensibility allowing for various programming approaches, it also enables students to grow into skilled developers more effectively. He draws parallels between learning programming and the skill of high-fiving, illustrating how critical thinking and practice are essential to mastery.

Key points discussed in the video include:

- Ruby as a Craftsman's Language: Clark describes Ruby as a flexible and extensible language suitable for both novices and experienced programmers.

- Community and Collaboration: He emphasizes the importance of community in enhancing the learning experience, with a focus on collaboration and quality expectations from junior developers.

- Learning Process: Through a personal anecdote involving a high-five, Clark highlights the significance of trial and error in learning, drawing a comparison to programming where understanding the 'how' leads to insights about the 'why'.

- Critical Thinking in Programming: He categorizes thinking in programming into critical reasoning, analytical reasoning, and logical analysis, stressing the importance of understanding not just how to code but why specific methods are preferred.

- Training Efficient Use of Ruby: The video discusses the benefits of teaching Ruby in boot camps, noting how it opens up complex concepts without overwhelming students with intricate technical details.

Throughout the talk, Clark mentions important concepts like MVC patterns, object-oriented programming, and the significance of writing readable code over mechanical learning. He concludes that while there are concerns regarding the influx of junior developers, the market's demand for quality software continues to grow.

Conclusions and Takeaways: Ruby is depicted as an ideal first language due to its supportive community and the emphasis on critical thinking and craftsmanship. New developers cultivated in Ruby environments tend to mature quickly, leading to better software quality and innovation in the industry.

00:00:23.599 Thanks everybody! My name is Matt Clark, as you just learned. I just discovered that Notch is the name of the guy who wrote Minecraft—that’s not me. I’m with a company called Notch8, which is a consultancy based in Portland, Oregon. I am also a partner at a code school down in San Diego called Learn, which focuses on Ruby and JavaScript, like most of the code schools that you find across the country these days. When we put our first class together in January, they graduated in May. As we were thinking about what we wanted our curriculum to be, we knew we wanted to focus on Ruby. We stand on the shoulders of giants who’ve come before us, like Dev Bootcamp and Hack Reactor. Ruby is what I know, and it's what my partner in San Diego knows, so of course, we're going to teach Ruby. However, it got me thinking about how I've always viewed Ruby as a craftsman's language. It’s a really extensible language; it's flexible enough that you can modify almost anything. Are we giving these students a Ferrari and asking them to learn how to drive? I don’t think so. Ruby is a fantastic first language for programmers, and I'm going to explain why that is.
00:01:20.240 While I was preparing for this talk, I was reminded of a soccer game when my son was three, about ten years ago. It was an indoor soccer game, and they had bumpers around the basketball court, which had goals on each side. Has anybody ever seen a peewee soccer game? They’re really fun! All the kids who show up get to play, and there are usually ten to twelve kids. They throw the ball out, blow the whistle, and the kids mob around the ball. Every once in a while, a goal gets scored, but they don’t keep score. One time, one of my son's teammates scored a goal, and my son was really excited about it. He ran up and wanted to give her a high five. She kind of looked puzzled but then realized what he wanted to do. They set up for the high five, went for it, and completely missed—total airball! They’re three and determined to make it happen, so they reset and go again but miss again. By the third time, they decided to really think about what they were doing. So, they stood next to each other and, at the same time, grabbed each other’s elbows and guided their hands together for the high five.
00:02:02.720 By this time, the parents were cheering just as loudly for the high five as they were for the goal, myself included. This made me think how high-fives are actually a craftsmanship skill that you develop. There's a science to it, and you have to practice to get better. You also need to pair up when you high-five; high-fiving by yourself is just clapping! You can even practice test-driven high-fiving, like my son did. They had a failure and had to figure out what was wrong. They utilized their critical thinking skills and set up an easier test by bracing their elbows. This led me to think that we need a high-five boot camp. Stick with me—this could be amazing! I believe the right demographic for this would be second and third graders.
00:02:48.439 During the four months they spend eight hours each day honing their high-five skills, we could incorporate trampolines to create aerobatic high-fives. Even think about borrowing from movies to include some wires for amazing Kung Fu high-fives, like from The Matrix. Imagine if Neo and Trinity had shared a high-five instead of just facing a big fight at the end. It would have changed the movie and definitely made a funny internet meme. Going back to the example of my son and his teammate, they had to apply reasoning to their actions. They had a failing test; they had to think about why their hands weren’t connecting. They presumed the issue was with their elbows, and when they tested that, they were correct. If they had continued, they would have gone through a red-green-refactor cycle and eventually nailed those high-fives without the braces.
00:03:37.280 The purpose of my talk is that Ruby holds your elbow. This is unique among programming languages that beginners typically start with. I should admit that during lunch, because of Ryan's talk, I almost rewrote my entire deck to focus on the cool things other languages are doing to teach programming. But I’m sticking to the three languages I believe are most commonly gravitated toward: PHP, JavaScript, and Ruby. There are three types of logical thinking: critical reasoning, analytical reasoning, and logical analysis. Critical reasoning involves evaluating arguments and poking holes constructively. Analytical reasoning concerns drawing conclusions based on facts. Logical analysis is about validating your facts, singling out assumptions, and determining how to test those assumptions. When we talk about critical thinking in programming, we usually refer to the logical analysis piece.
00:04:39.199 It's about figuring out what assumptions we made in our code and whether they are true. So when we discuss the how and the why of programming, the how refers to the semantics—the language used to express your ideas. The why relates to understanding why we do things a certain way. The how can be quite simple. You could be a programmer just by taking code from a WordPress blog and pasting it onto your site to create a like button instantly. However, when programming 'how', the focus becomes how to make things work as quickly as possible. There are tougher examples of programming that require more thought, like establishing database connections, but those will teach valuable lessons.
00:05:23.600 The 'high five' gets set with enthusiasm but leads to challenges. For example, when I run my specification, it might not pass until I define my method correctly. When it doesn’t pass, I ask why, write my method, and celebrate when it finally passes. This process becomes second nature for individuals who have been programming for a while but can be a completely new concept for those just starting. Many new programmers are often focused only on achieving an end result quickly and haven’t yet learned the importance of breaking down their projects into logical components and thinking critically about their code. At Notch8, we have been bringing in junior programmers and valuing their development, which contributes to the culture and success of our team. The day-to-day involves helping them connect the dots and avoid falling into bad habits.
00:06:26.919 As I move from pair to pair in our workspace, I often see signs that developers are struggling. For instance, if someone submits a form and checks their stack trace to troubleshoot, that indicates a wrong approach to critical thinking in programming—they’re too focused on getting to an end state without breaking their code down effectively. When this happens, I make it a point to pause and reevaluate the components of the problem. We’ll examine whether their models are set correctly or if their controllers are routed correctly. Getting back to the question of why helps them think critically about their code. This year, one of my personal goals has been to find ways to lessen that curve of developing muscle memory as a mentor.
00:07:35.360 There is a common concern amongst some experienced programmers that new recruits, coming straight out of coding boot camps into Rails, don’t always have a firm grasp of SQL. They may think this is problematic as SQL drives our database-backed web applications. It’s essential to understand SQL, especially when Active Record stops doing what you want without some SQL knowledge. However, I believe that many of these junior programmers get lost in the mechanics of data access where they might not be exposed to the critical thinking behind it. One of the significant advantages of using Rails in Ruby at boot camps is that we can quickly teach them the concepts of how objects relate to each other in a model.
00:08:36.960 We do provide around a week of SQL education because they must understand the SQL that operates behind the scenes. However, it’s even more important that new students grasp the concepts and don’t become bogged down by the minutiae of SQL coding. DHH (David Heinemeier Hansson) spoke about how we, as software developers, are not necessarily computer scientists but rather writers of code. This distinction is essential, especially for new programmers, as they're learning what their code does and its implications. It’s crucial to write readable code for your co-workers and future developers, as our computers will ultimately interpret it, but understanding comes first.
00:09:45.160 Speaking of DHH, he noted that for individuals learning to use the Rails framework, they don’t need to worry about where all the code belongs or the required statements. It’s somewhat akin to playing Minesweeper; you start with a blank slate and gradually uncover the game's hidden elements until you understand the full context. Learning Ruby and Rails presents an opportunity to focus on small pieces of a complex application without getting overwhelmed by the entire picture. This understanding will help them build a solid foundation without getting lost in details. Constraints and crutches, like those imposed by frameworks, can lead new developers to a simpler understanding of their applications.
00:10:55.120 The MVC (Model-View-Controller) paradigm is crucial in this vein. I’ve had trouble determining where to fit MVC into my talk as it doesn’t fit neatly into the how and why discussion, but these design patterns are precious learning tools passed down from those who came before us. They provide frameworks to solve problems but can also become a crutch if overused by new students. However, even misuse can be constructive, serving as opportunities for discussions on deciding why certain patterns are applied.
00:12:01.760 Anyone familiar with the theory of forms from Plato? It's a philosophical concept that argues reality is made up of two realms: the concrete and the abstract. The podium I’m standing before is a concrete representation, whereas the idea of a podium that exists in one's mind is the abstract perfect version of it. In the programming world, when we describe structures or concepts, we’re often speaking about that ideal programming concept, not just the concrete implementation. The confusion often arises, as some argue that Rails isn’t traditional MVC because changes in models do not automatically update views. But, in reality, Rails largely adheres to MVC principles within the constraints of HTTP and the application's structure.
00:13:03.440 Ruby is enjoyable because it enables aspiring programmers to bypass the 'how'—the minutiae of building applications—and focuses their thinking on 'why'—the logic and reasoning behind programming. The happiness of programmers is critical; witnessing a new developer, who is only beginning to grasp programming concepts, achieve a breakthrough is inspiring. They suddenly figure out how to iterate through an array and successfully apply their newfound skills, prompting a real sense of achievement. This capacity for understanding allows new Ruby programmers to ascend that learning curve swiftly, as they can build their knowledge based on concepts rather than just mechanics.
00:14:05.640 Alan Kay, the creator of Smalltalk, emphasized that object-oriented programming isn't about the objects themselves but about the messages exchanged between them. Ruby embodies this concept well. Take the 'attr_accessor' method: it isn't straightforward at first glance why I defined that method, but when you write it out explicitly, it demonstrates that we’re sending a message to our class. All classes in Ruby are objects, which firmly accept messages just like any other object would.
00:15:01.880 Understanding these nuances is essential. For instance, the 'defined method' operates similarly to 'attr_accessor' as it, too, sends messages to classes. This may not have been clear to me in the beginning of learning Ruby, but it’s a crucial insight for new developers. The how part begins with learning to write software correctly, which I believe is what new Ruby developers grasp well due to the ability to engage critically with their code—writing tests and refining their work.
00:15:56.659 Learning Ruby is about developing craftsmanship; it’s vital that students internalize this. They emerge as pre-polyglots, ready to explore numerous languages, although we may hope they’ll pick Ruby based on their experiences. The initial positions, internships, and personal discoveries will shape what they eventually pursue. Ruby’s benefit lies in its ability to open conversations around these concepts rather than getting bogged down in syntax and technical details.
00:17:04.960 As our school is new, I’ve been curious about how many graduates from code schools go on to Ruby positions. I spoke to Epicodus' placement coordinator, which is a superb code school in Portland. They work to place candidates by connecting with around 400 companies and, interestingly enough, approximately 45 of those are Ruby shops, with another 20 that integrate Ruby in some capacity. This means about 15% of the companies are operating in that space. She revealed that roughly 50% of those graduates who seek jobs actually find positions in Ruby shops, leaving the other half to apply their Ruby knowledge to other languages and challenges.
00:18:10.320 Our focus should be on building up good critical thinkers, more than just good Ruby programmers, as these skills are transferable to other programming contexts. Understanding why we do things is as crucial as understanding how we do them; practices such as pair programming, Test-Driven Development, and writing readable code stand as examples. This stems from a quote from The Princess Bride, where Westley, the main character, reflects on his job as a pirate. It resonates with my experiences in programming, as my first job was not ideal.
00:19:00.960 I didn’t realize it at the time since I was unaware of alternatives and had no programmers to consult. I showed up every day with an impossible list of tasks, ultimately leading to tumultuous discussions about my future with the company. Eventually, I recognized that it likely wasn’t the best work environment for my growth. One personal goal has been learning from my own experiences and ensuring new developers do not find themselves in similar situations, lacking the understanding of why certain practices exist. If we instill in them these core principles about TDD, writing extensible code, and high-quality craftsmanship, they'll have a benchmark to measure their experiences against.
00:20:03.600 Boot camps should be a source of happiness. This part of my talk is a bit of a soapbox issue for me. There are concerns about the influx of junior developers entering the Ruby job market. Will this affect job prospects? Will they drive down wages? In fact, I think not. We’re operating in a vast market where increased software creation raises consumer expectations, thus creating more demand for quality software. As we produce thoughtful developers skilled in Ruby as opposed to more commoditized markets, the overall quality bar continues to rise. Ultimately, as they mature and evolve into senior developers, they will have a lasting impact on our industry.
00:20:59.440 Several companies, like Apple in its App Store iteration, have continuously pushed for higher quality, which has been essential in shaping what the current development landscape looks like. At Notch8, we do extensive work within the medical industry, driving efforts to raise usability standards. Businesses often express their excitement when they see the products we deliver, as they were previously unaccustomed to quality work of that nature. It’s a rewarding experience to witness that transformation.
00:22:07.480 Shopify’s impact on e-commerce is another illustrative case. They have commoditized online retail, allowing non-programmers to set up operational stores quickly. Should we mourn the loss of traditional web developers in this space? Quite the opposite. The demand for better back-office solutions continues to grow as consumers expect more quality, which leads to further development, innovation, and opportunities in other sectors.
00:23:06.480 Reflecting on the past, we can liken the rise of good programming to the era of Internet Explorer in the late '90s and early 2000s. While developers dealt with numerous challenges posed by the browser’s limitations, today’s environment sees an open call for ideally crafted software solutions. It’s essential for developers to encourage others to hone their skills, especially in languages like Ruby, which call for a commitment to producing top-quality software.
00:24:08.760 As more developers enter the field and raise the quality bar, it creates a healthy demand, and subsequently, opportunities for career advancement and salary increases. For those concerned about competition, it’s vital to remember that acquiring expertise takes time. Thus, there’s ample opportunity for everyone in the field.
00:25:05.600 In conclusion, I talked about Ruby as an exceptional language for teaching developers due to its focus on cultivating critical thinking and concepts rather than getting caught up in minutiae. Its community fosters an atmosphere that keeps students engaged in quality production techniques. Thank you for your attention! I'm Matt, and you can find me on Twitter as @winScout.
Explore all talks recorded at MountainWest RubyConf 2015
+10