Debugging

I’m old enough to recall the days when debugging a program meant deciphering an error message that looked something like this:

4/-

Not very helpful.

Zoom forwards 40 years to the “it just works” philosophy of Apple, and Xcode kindly displays an error message that reads thus:

Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ff7bdf3cff8)

As the famous fictional Doctor McCoy once said on Star Trek – “it says a lot but tells us nothing”.

What does the error actually mean? Well, translated, it really means:

Good luck with your 3-hour hunt around Google, because I ain't tellin' you jack!

On inspection of my code, I found out the cause of the error. I’d missed out a dot. Yep, a dot.

Rectangle()
    foregroundColor(.white)
    .frame(height: 48)
    .cornerRadius(10)

The above should have been this:

Rectangle()
    .foregroundColor(.white)
    .frame(height: 48)
    .cornerRadius(10)

So, in Apple/Xcode/Swift terminology, the error “Whoops, you’re missing a dot” is delivered as Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ff7bdf3cff8). Sometimes I wonder if they want people to learn this stuff at all, or if it is their intention to wrap it up in so much mystery that we’re all left revering the “code magicians” and their “magical incantations” who actually get it to work.