Skip to content

swifteves/debug100

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Adrian's 100 Ways to Debug Stuff

This is part of a challenge issued to me by my friend Matt. I'm writing with the lens of the Swift developer, but a lot of these things apply in principle to other languages, such as Java, C-based languages, and more. The syntax is really the differing factor.

1. Print Statements

Don't act surprised. You knew this one was coming. We all do it, even if the 10x engineers look down upon us for it. But in all seriousness, it's a useful tool nonetheless, and it's almost instinctively within reach for even the newest developers. When you use a print(...) statement, you can expect to see output in the console. You can use it to see if your code reached a certain path without halting execution, which could come in handy if you're checking multiple things. It's also handy for checking what the value of a variable is at any given time. Print statements are also commonly used to evaluate what's happening at different points in your app's life cycle. The great thing about these statements is that they don't stop our code's execution, and we can basically read a continual story about what's going on. Now, it's not a perfect solution for several reasons. First, if you're on a team, leaving print statements in your code is really easy to do by mistake, and it can cause an extra round of reviews for you just to remove them. Second, as things get more complicated, so does your console. Third, they don't truly enforce correctness because we're reading things and mostly accounting for our minds to evaluate whether or not things are going well. So to sum it up, print statements are useful, yes, but they're not necessarily great to leave in your codebases, especially for teams. Taking them out can be a hassle, and often times we quickly scribble them in ways that make sense only to us. Use them however you see fit!

About

100 items of debugging tips and tricks for the year 2025

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors