Codenewbies: Don't be lazy when it comes to debugging, especially if you knew better right from the onset
That’s what I learned from my first 4-day hitting-head-against-wall experience of trying to debug code.
I wanted to do a POST request to my Rails API using a Vue app. Both are super basic setups, just for learning purposes on how to develop an API and to use it. And out of laziness and not doing prior research, I created a single text input field to POST to my API, thinking that if I type a proper JSON in the text input it would work. And of course, it didn’t. Actually before that, I somehow knew that I needed to have a proper form to structure the JSON so that it gets POSTed properly, but I was lazy. And all because of a little bit of laziness, I spent days to debug what could have been solved in a few hours.
So the key lesson I need to hammer into my head: DON’T BE F**KING LAZY, especially if you knew better.
There’s no shortcuts in coding. Yes, even using libraries and frameworks. All shortcuts come with trade-offs, and a price. You either pay it much later, or very soon. Thankfully I paid up in four days. Imagine if I had to hammer at this for weeks?! I would have given up coding altogether. But that also showed me just how much perseverance is needed when it comes to coding your own thing. More bugs like this will come for sure, and very likely even bigger ones taking more days or weeks.
Better to enjoy the challenge, than to want to wish it away at first encounter.
It’s strange, I do kind of enjoy digging down deeper into the rabbit hole to solve a problem. And even stranger - there’s a stubborn kind of streak in me that ‘likes’ to keep at it till I win. Man vs machine kind of game. It’s not always a delightful game, but a satisfying one nonetheless when I solve it.
If this was a relationship, it ain’t romance and fireworks in the honeymoon period. It’s fighting and loving, hitting and kissing, all at the same time. Not a typical relationship, but one full of life for sure!
Follow my daily writings on Lifelog, where I write about learning to code, goals, productivity, indie hacking and tech for good.