Break it. Fix it. Repeat.

You might not know much about cars, and to be honest with you, neither do I. However, I’ve learned more about cars when they don’t work, than I ever have when they’re running properly. For example, I’ve learned a whole lot more about changing tires when I had a flat one, than when I didn’t.

The same is definitely true with programming, and other areas of life as well. If you want to learn how to do something, then break it. Make your code broken. Let somebody else break it for you. And then, you will learn way more about how it works when you try to piece it back together.

I had an experience like that this week. You may have seen my recent blog post about creating an API using MongoDB. The thing you never realize about these ‘tutorials’ is what really happened behind the scenes. You may have read my tutorial and been like, “Man, everything is just rainbows and unicorns for Ethan, he just made that way too easy.” But what I didn’t include in that post, is how I spent 3….freaking…..days….troubleshooting one problem. And what problem was that? Getting my database to connect to mongoose. Yeah, kind of a big thing right? I mean, if you’re setting up a database, connecting it to the program that is going to read and write to it is, I don’t know, probably like the most important thing.

Here’s the line of code. One line. And that’s what threw me off for three days. I tried everything. At one point, I even dropped my entire database, and created a brand new one, reconnected that one and changed my Schema twice. I even started the entire project over from scratch, but to no avail.

And do you know what my problem was? I had typed ‘mongoosedb’ instead of ‘mongodb’. 3 days, because of a misspelled word.

But, here’s what I gathered from it, and hopefully, this will be some words of encouragement to anyone who has felt the same type of frustration. Because I spent three days rebuilding this thing twice, I now have such a solid handle on mongoose and mongo. I feel like I could do it with my eyes closed. Had everything been roses from the beginning, I probably wouldn’t understand it now on the same level. In face, that entire tutorial that I posted yesterday may not have been possible had I not struggled with it to get it to work.

So in conclusion, if there’s a concept, a language, or a program you’re having trouble understanding, my advice is, break it. Have someone else break it. And then put it back together.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.