RailsConf 2014

Workshop: Ruby Coding Dojo

Workshop: Ruby Coding Dojo

by Carlos Souza and David Rogers

The video titled 'Workshop - Ruby Coding Dojo' features Carlos Souza and David Rogers discussing the coding dojo concept within the context of software development at RailsConf 2014. The primary aim is to enhance participants' programming and social skills through collaborative coding exercises in Ruby. The workshop is framed around the importance of practice in coding, likening it to the discipline found in martial arts, music, and athletics. Key points from the video include:

  • Introduction to Coding Dojos: The speakers introduce the concept of a coding dojo, explaining how it serves as a space for developers to collaborate, practice, and improve their coding abilities.
  • Diversity of Skill Levels: The workshop accommodates varying levels of programming expertise, urging all participants to embody the mindset of a developer, regardless of their experience.
  • Continuous Learning: Both speakers emphasize the rapid evolution of technology and tools in software development, highlighting that it’s crucial for developers to keep pace with these changes through dedicated practice.
  • Practice vs. Work: The distinction between practice and work is clarified, asserting that actual skill improvement arises from purposeful practice rather than work-related tasks.
  • Pair Programming and Katas: The dojo format often incorporates pair programming and coding katas—structured coding challenges—to foster learning. This approach encourages communication, collaboration, and repeated practice of coding techniques.
  • Iterative Development Process: Within the dojo, an iterative methodology like Test-Driven Development (TDD) is adopted, where developers first write failing tests, then create minimal code to pass these tests, followed by refactoring. This promotes quality and maintainability in coding.
  • Real-World Applications and Examples: Through a live demonstration, the speakers engage participants in hands-on coding activities, illustrating concepts with practical coding examples, such as developing a simple calculator in Ruby.
  • Retrospective and Reflection: The workshop concludes by encouraging participants to reflect on their experiences, identify areas for improvement, and foster a culture of continuous learning and sharing within their respective teams.

Overall, the workshop promotes a culture of collaboration and iterative learning among software developers, illustrating that through coding dojos, practitioners can enhance both their technical and interpersonal skills, making them more effective in their roles.

00:00:16.480 All right, thanks everyone for coming. It's a great pleasure to be here at RailsConf. Just so we know who's coming to RailsConf for the first time, wow, that's amazing! Welcome! Today, we're going to talk a little bit about Coding Dojo and how you can use the dojo to improve your coding skills and become better developers. My name is Carlos Souza and this is my friend David Rogers. We are both from Orlando, Florida, and we work for Code School. We love development and we love teaching. That passion for development and teaching others how to develop brought us to the Coding Dojo. We formed our Coding Dojo group back in Orlando a couple of years ago and ran it bi-weekly for about two and a half years. We also use the Coding Dojo as a teaching tool.
00:01:13.600 What we're going to do here today is to teach you a bit about our experience running the dojo, and we're actually going to run a dojo with you. Hopefully, you will feel inspired to conduct dojos on your own, at your company, with your friends, or at your local meetups. This is a message to all developers—we're all developers here, even if you're not coding on a day-to-day basis. I ask you to put on your developer hat for just a little bit to understand where we're coming from and the problems we're trying to solve with the Coding Dojo.
00:01:30.000 We have different levels of expertise among developers. Maybe you're a beginner, just starting out in the first couple of years of software development with Ruby and Rails. Perhaps you just graduated from a dev boot camp, or maybe you went through college or are taking online classes. Or maybe you're a bit more advanced; you've been working with some programming language and framework for a couple of years, starting to take on more responsibilities at work and lead projects. Some of you might even be experts, having worked in software development for over a decade; perhaps you're an architect responsible for architectural decisions in your company.
00:01:52.640 Regardless of your level of expertise, you've likely realized that the technology you're working with evolves and improves over time. The tools we use are getting better, especially in the open-source community, due to natural selection. If something isn't good enough for the community, they will seek better ways to do things, adopting better practices, tools, and frameworks. For example, Rails has an average of a hundred commits every week; things change very quickly.
00:03:04.160 Rails is just one of the tools you use daily. When you stop to think about it, you're using Rails, Ruby, Bundler, and a variety of open-source tools, all of which are changing constantly. Many changes occur daily, with new features being added, old features removed, and existing ones altered. It is really challenging to keep track of all these changes, especially as developers. We might not improve at the same pace that our tools are evolving.
00:03:59.920 We should take a cue from other creatives and artists, such as musicians and athletes, who also rely heavily on their craft and dedicate time to practice. Martial artists practice daily, while musicians put in considerable effort before going into the studio or performing. These professionals spend countless hours honing their skills so that when it comes time to perform, they are prepared. Just like them, we, too, need to practice to improve our craft.
00:05:25.520 David will talk a little bit about the importance of practicing. You know, the key point here is that, as practitioners of our craft, we also need to practice. Anyone read Malcolm Gladwell's book, 'Outliers,' or heard of it? The key takeaway from 'Outliers' is that while some people might seem exceptional, it turns out they spend a lot more time practicing than the average person. Gladwell suggested that it takes about 10,000 hours of practice to become an expert in a given field. The main insight is that practice is not something you do once you get good; it’s the activity that makes you good.
00:06:42.080 Some of you might say, 'I practice every day!' But keep in mind that work does not equal practice. You might be spending hours at work coding, but that doesn't necessarily mean you are practicing your craft. Look at professional martial artists or concert violinists—they hardly perform as much as they practice. Likewise, our daily work tasks are not practice; they constitute work that needs to be done.
00:07:14.320 This brings us to the inevitable question: how do we practice what we do? What does practicing code actually look like? One way to figure that out is by emulating how other artists practice their craft. In martial arts, the term dojo signifies a place where individuals practice those arts. This term was introduced to programming by Dave Thomas of the Pragmatic Programmers who suggested that we establish a dojo environment for programming, allowing us to practice coding.
00:08:06.080 The essence of a good coding dojo parallels that of a martial arts dojo; it’s a safe, collaborative, and non-competitive environment where we can practice together. During these sessions, we learn to code, practice our programming, and engage in teaching and learning, all while having fun—much like in any martial art or even yoga. That is the ultimate goal of the dojo.
00:09:08.480 In martial arts, we practice katas, which are detailed choreographic sequences of precise movements that can be practiced alone, in pairs, or in groups. Katas might not have direct application in combat, but they teach vital skills such as punching, blocking, and evading through repetitive movement practice. Similarly, in programming, we use coding katas—choreographed patterns of coding exercises practiced either solo or in pairs—to reinforce skills.
00:09:58.320 In the coding dojo, we embrace the concepts of test-driven development. Many of the authors who coined the terms dojo and katas also advocated for extensive testing. Our focus during these sessions will be on mastering the art of testing. Like martial artists go through the motions of their katas extensively, we too should practice writing tests extensively so that when it's time to develop production code, it becomes second nature for us to decide how much testing is necessary for a given feature.
00:11:00.880 We also practice pair programming. Pair programming is more than just sitting next to someone coding; it requires a unique set of social skills. It involves knowing how to suggest ideas, accept constructive criticism, and not take feedback personally. There’s much more to it than simply watching someone code or telling them what to do. These social skills are vital in any programmer's journey, and while they might be particularly emphasized in the dojo, they also have a lasting impact on software development.
00:11:57.760 When we pair program, we often use a ping-pong approach, similar to how one plays table tennis. One person writes a test, the test typically fails, and then they hand the mic over to their partner, who writes code to pass the test. This way, both members maintain an active role, ensuring everyone is engaged and learning from each step. We will be demonstrating this as we proceed through the coding dojo exercise.
00:13:36.480 As we move through the coding dojo, we will encounter different types of katas. The three most popular ones include the Randori kata, the prepared kata, and the code retreat. The Randori kata is the most frequently utilized in meetups and schools. In this format, one computer is used to code in front of an audience, allowing for real-time observation of the code's evolution towards a solution. Audience members can actively engage in discussions while the pair programming duo rotates every few minutes.
00:14:47.840 David uses this method in his classes at the university to teach programming concepts and practices. Over the years we’ve been running the Coding Dojo in Orlando, we’ve welcomed a variety of participants, from those with no coding experience to seasoned developers. Interestingly, we found that even expert developers often show less interest in the format, but we have used the dojo to learn new tools and languages, solving different coding challenges together.
00:15:50.080 In our next segment, we will be running a prepared kata, which is where we will show you how to solve a predetermined problem as a demonstration. Again, you'll be following along, trying either to do it on your own or assisting as a spectator as we tackle the problem step by step. David and I have prepared this example, which entails creating a simple calculator that performs addition.
00:16:59.360 This operation will accept two numbers and return the result. We won't be using any specific frameworks. Instead, we'll be utilizing Ruby 2.0, along with the built-in MiniTest framework. If you want, you can follow along, or you might choose to observe first and then try it yourself later. As we perform this kata, both David and I will be exchanging roles using the ping-pong approach to ensure that everyone stays engaged and learns from each iteration.
00:18:35.600 So, let's get started by opening a file named kata.rb—there’s nothing in it yet, but we'll develop a simple calculator. Ensure that you have the necessary libraries required for MiniTest imported at the top of your file. We’ll begin by creating our test case for the calculator, followed by writing our first failing test that addresses our addition method.
00:19:42.840 We'll initiate a new test case within the MiniTest framework. The first task is to test that two numbers can be successfully added together using our addition method. Don't worry if you encounter any errors during this process; as you'll see, they will help guide you on what needs to be done next to ensure correct functionality.
00:20:50.320 The principle of test-driven development dictates that we should write tests that fail before implementing our production code. This serves as a way to illustrate what we’re aiming for, and we utilize the resulting error messages to refine our coding process. Remember to conduct repairs on your tests with the aim of achieving a successful run, and you can always return to reorganize or refactor your code as needed.
00:22:01.360 As we commence our kata, we'll be developing the simplest solution possible that fulfills our initial test. This will involve creating variables and implementing the core logic needed to pass the test case we defined. Once we achieve a green test, we must consider refactoring our code for efficiency or clarity. Refactoring helps maintain clean and maintainable code.
00:23:54.560 I’ll hand things back to Carlos, who will guide us through the next steps as we progress in our kata. If you have any questions or need clarification, don't hesitate to ask or raise your hands; we'll be here to assist.
00:25:30.480 As we dive deeper into the kata, we’ll be addressing another functionality of our calculator, which is to allow for more numbers to be added together. This will require some additional logic as we test various cases. Again, we’ll use our test-driven approach—always keeping our tests in mind as we strive to meet all functional requirements.
00:26:44.640 Once the foundational functions are in place, we will emphasize clarity and precision in our code. This will resonate with aspects of best practices we established earlier. As we work, it's essential that we maintain thorough documentation and comments explaining function purposes, especially as the complexity increases. This approach leads to improved collaboration among team members and eases future maintenance efforts.
00:27:59.840 As we carry out our tests, we’ll also utilize assertions to confirm that our expected outcomes align with our actual outputs. Should there be discrepancies, we’ll modify our code based on feedback from these tests. Iteratively making changes helps us develop a deeper understanding of the language—its quirks, conventions, and idioms.
00:29:12.480 At this point in our kata, we are focusing on the overall design and maintaining an effective coding style. Identifying any patterns of repetitive code—known as 'technical debt'—is crucial. Addressing technical debt early prevents complications down the road, ensuring our code remains agile and adaptable.
00:30:30.560 As we progress, we will begin testing string inputs and exploring how to process those inputs efficiently through our calculator. Things like handling characters, parsing numbers from strings, converting values, and error-checking will enhance our program's resilience.
00:31:36.720 After developing a better understanding of our implementation, the next logical step involves taking user feedback into account through testing cycles. We will gather insights from multiple scenarios, introducing various inputs and complexities to understand how our calculator performs in real-world applications.
00:33:05.840 As we finish the first kata, we will take a moment to pause and reflect. First, we will discuss what we did well and plan improvements to implement for our next session. This retrospective is essential for personal growth, team cohesion, and reinforcing the art of learning through coding.
00:34:44.640 After our reflections, we'll be ready to dive into a new challenge. As we get started on this new kata, we’ll focus on implementing addition using string inputs (for example, '1 + 2' should return '3') and continue to practice various programming paradigms we've touched upon. Let's make sure that we consider edge cases and have fun while tackling this new exercise!
00:36:20.160 Moving forward, we aim to tackle even greater challenges. We facilitate discussions and share ideas to encourage a lively learning environment. As we work with string conversions and parsing numbers, we will ultimately refine our logical reasoning and strengthen our programming skills. Welcome this new coding adventure and embrace the creative process!
00:37:59.680 We’ll be wrapping up our kata by emphasizing the importance of collaboration, practice, and discussion as fundamental elements that propel us towards success. Participating in a coding dojo nurtures camaraderie while simultaneously enhancing educational outcomes. All questions and curiosities are welcome, and we are fired up to share knowledge throughout this continuous learning journey.
00:39:56.640 As we delve into today's final kata, let’s focus on what we can streamline in our processes—like enhancing our test suite, increasing test coverage, and efficiently managing time and resources while coding. We will take what we’ve learned from practicing code katas and find innovative ways to refine our current projects. Anticipate the shifts in design approach and be prepared to embrace the next-level challenges!
00:41:31.840 After a short break, we are ready for a new exploration. You will see how creativity influences programming, providing solutions that are logical yet imaginative. Interweaving the form and function of code allows for practical applications down the road. Your goal is not to just meet the requirements, but to improve upon them iteratively.
00:42:52.000 Bring your newfound skills to the table as we adopt new methods and solutions. The way forward is about collaboration, learning, and interacting as a team. Together, we will outline what’s next on our agenda and the remaining objectives that help us grow individually and collectively.
00:44:43.760 We'll transition to brainstorming practical solutions for programming challenges, applying all we’ve learned regarding testing, validation, and system robustness. Let's now move forth with confidence as we explore new scenarios, embracing creativity at every junction. The focus is both on relevance and efficient implementation that will highlight the programming principles we've practiced today.
00:46:39.680 It’s been an impactful journey today as we’ve implemented coding dojos and practiced pair programming within varied contexts. The aim is to practice engagement techniques, improve scripting, and spend time refining your skills. Remember that coding is a very collaborative experience where all participants should feel empowered to voice insights and solutions.
00:48:34.640 As we wrap things up, we should each consider how to implement what we’ve learned back in our everyday coding routines. Embrace the highlights of today’s learning: collaboration, practice, and engagement with peers—elements to remember as you transition to real-time software engineering challenges. Let's continue this momentum into the next sessions!
00:50:25.920 Thank you all for participating in today's workshops. The coding dojo format is meant to foster collective intelligence while allowing every individual a chance to shine. As we diverge into the various programming realms, keep what we learned close to heart. Let's make sure to share what we’ve experienced with others, inspiring growth in our wider communities. Remember, as developers, we all share a remarkable journey of continuous learning and improvement.