In this episode of "Ruby for All," hosts Andrew and Julie take us through a journey of debugging, from dealing with weather-induced moods to squashing tricky bugs in their code. They touch on the challenges of debugging without audio guidance, leveraging logs for troubleshooting, and the logical approach to handling errors in Ruby or JavaScript. They dive into the variations of different debugging tools, such as Pry and the Rails Logger, and the complexities of transitioning to new debugging gems. Andrew recounts a perplexing bug only replicable in production and details his process and concluding the issue. As they navigate the intricacies of problem-solving, they contemplate the worth of fixing minor bugs versus prioritizing major ones, drawing on real-life examples from their experiences. Andrew wraps up with a reminder of the importance of teamwork in debugging, while they both acknowledge the reality that sometimes, a bug might just remain unfixed. Join them as they share insights and laughter, reminding us of the human element in the world of code.
[00:00:54] Andrew describes the bug issue he had and the difficulties of debugging it without audio in the screen recording, and Julie shares her own debugging challenges on her new team.
[00:02:00] Let’s talk about debugging, as Andrew explains different types of bugs and shares his process for understanding and reproducing bugs. Julie emphasizes the importance of understanding the product and the expected behavior to replicate and debug issues.
[00:03:31] Andrew describes his approach to getting unstuck during debugging, which includes revisiting the problem statement and using logs to trace the issue.
[00:05:14] Andrew asks Julie if she can replicate her bug in production and suggests using logs for troubleshooting. Julie talks about her approach to errors, which differs as she doesn’t typically see the red Rails error page in her work. They discuss how to deal with JavaScript errors and the importance of reading error messages.
[00:08:57] Julie inquires why some developers may overlook details in error messages, and Andrew suggest that assumptions and a form of panic might play roles and discusses when he’s more likely to Google error messages, especially regarding dependencies.
[00:13:22] Andrew explains why he prefers using the ‘Rails Logger’ over ‘puts’ for debugging. He also mentions using Overmind and tmux for viewing Rails logs.
[00:14:39] Julie draws a parallel between ‘puts’ debugging and JavaScript’s console.log debugging. Andrew confirms they are similar, and he shares his transition from using Pry to the official debug gem and the difficulty of changing old habits.
[00:16:30] Andrew clarifies that binding.irb now uses the debug gem by default in Ruby 3, he discusses the usefulness of Pry’s context-switching feature, and he outlines additional steps for effective debugging.
[00:19:52] There’s a conversation on using git for tracking code changes and git-bisect for isolating commits that caused issues, and questioning assumptions, reading documentation, and getting a second opinion or sleeping on the problem.
[00:23:17] Andrew discusses the mindset required for effective debugging: patience, persistence, and the willingness to step away and return to a problem. Julie describes a very specific bug affecting a small number of users questioning with her manager whether it’s worth the effort to fix it.
[00:25:43] Back to Andrew’s story about a bug that he couldn’t replicate in development, but could in production, and he details his process and realization that it was a display issue in the front-end.
[00:31:09] Julie relates to Andrew’s difficulty in replication bugs in development and suspects filtering differences in production. Andrew suggests troubleshooting methods for errors related to data discrepancies.
[00:33:11] Andrew shares a tip about using data to back up arguments when trying to convince others during decision-making, and Julie recounts realizing the low impact of the bug she’s working on and it it’s worth the effort.
Panelists:
Andrew Mason
Julie J.
Sponsors:
Honeybadger
GoRails
Links:
Andrew Mason X/Twitter
Andrew Mason Website
Julie J. X/Twitter
Julie J. Website
Overmind
tmux
IRB
git/git-bisect
- (00:54) - Debugging Dilemmas: Screen Recordings Without Sound
- (02:00) - The Debugging Process: Understanding & Reproducing Bugs
- (03:31) - Unstuck Strategies: Logs & Revisiting the Problem
- (05:14) - Logs for Troubleshooting: Rails vs. JavaScript Errors
- (08:57) - Overlooking Error Messages: Assumptions & Panic
- (13:22) - Rails Logger vs. Puts: Debugging Preferences
- (14:39) - Debugging in JavaScript: Console.log Similarities
- (16:30) - Ruby Debugging Evolution: Pry to Debug Gem
- (19:52) - Git Tricks: Code Tracking & git-bisect
- (23:17) - Debugging Mindset: Patience, Persistence & Breaks
- (25:43) - Production Bugs: Front-end Display Issues
- (31:09) - Replicating Bugs: Development vs. Production
- (33:11) - Data-Driven Decision Making: Convincing with Evidence