16 September 2017
Coding is debugging.
One thing I’ve learned since starting to program is that you spend a lot of time trying to fix your code when it breaks.
Of clutching your head, shaking your fist and swearing profusely.
Of imagining yourself bashing your laptop (or your head) against the table.
Of wondering why you started doing this in the first place.
It’s frustrating. But it’s part of the process.
While being light-years away from being an expert, I’ve gotten better at fixing my errors.
When I get an error in a program I try to understand what exactly the error message is saying. They can be pretty cryptic, but I try and get the message’s meaning as best I can.
I re-check the basic stuff…is the package imported? (Probably not.)
Did I use the right type of variable? (Oh, right. No.)
Are the files in the right place? (Nope.)
Did I forget a semicolon or use improper indentation? (Yup.)
Is something misspelled? (That too.)
Getting the fundamentals right takes care of a large chunk of my errors.
I read the documentation of the function or method in question to see how it’s supposed to be used.
I paste the error message into Google or Stack Overflow to see what others in my situation have done. Sometimes I find a decent answer but many times I wonder what these people are saying and why can’t they just solve the problem using plain English instead of technobabble bullshit.
I try to move forward in the smallest way possible. Sometimes, that could just be printing content to the screen. Any content. Once you get something up there you can work on getting the right thing printed.
When all else fails…I ask someone. I’ve been fortunate to have access to great programmers who know a hundred times more than me. People who will entertain my dumb questions and help me get better.
It’s worth taking the time to develop these relationships, and not just for the short-term problem-fix. Programming can be a dark and lonely road of early mornings and late nights. Of losing free time and turning down social events to work or study. These people bring a little bit of light onto that journey.