Chapter 6. When Things Go Wrong
Unfortunately, neither this book nor a lifetime of practice can cause you to attain Ruby programming perfection. However, a good substitute for never making a mistake is knowing how to fix your problems as they arise. The purpose of this chapter is to provide you with the necessary tools and techniques to prepare you for Ruby search-and-rescue missions.
We will start by walking through a simple but real bug-hunting session to get a basic outline of how to investigate issues in your Ruby projects. Weâll then dive into some more specific tools and techniques for helping refine this process. What may surprise you is that weâll do all of this without ever talking about using a debugger. This is mainly because most Rubyists can and do get away without the use of a formal debugging tool, via various lightweight techniques that weâll discuss here.
One skill set you will need in order to make the most out of what weâll discuss here is a decent understanding of how Rubyâs built-in unit testing framework works. That means if you havenât yet read Chapter 1, Driving Code Through Tests, you may want to go ahead and do that now.
What you will notice about this chapter is that it is much more about the process of problem solving in the context of Ruby than it is about solving any particular problem. If you keep this goal in mind while reading through the examples, youâll make the most out of what weâll discuss here.
Now that you know what to expect, ...
Get Ruby Best Practices now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.