Our instinct tells us that things shouldn’t be broken, but when it comes to coding, reverse that thought process. Regardless of what type (and level) of developer you are, coding relies on using a programming language to solve a problem, so naturally problem-solving is the most valuable skill you can have. So what’s the best way to improve your problem-solving skills? Find out what does and doesn’t work. Put your ideas to the test. Break your code and put it back together. In the world of developers, that’s what everyone does.
Find out what does and doesn’t work. Put your ideas to the test. Break your code and put it back together. In the world of developers, that’s what everyone does.
So how should you approach solving a problem with code? Guest teacher, Mat Helme published a great article on Medium called the Four P’s to problem-solving: Prep, Plan, Perform and Perfect. I’d recommend spending some time reading through his article and putting them into practice. (Hint: steps 3 and 4 are where you’ll break your code.)
- Step 1: Prep. Assess the problem that you’re trying to solve and establish an initial, high-level solution.
- Step 2: Plan. Think about how you’re going to tackle the problem and the steps you’ll need to take to reach the solution.
- Step 3: Perform. This is when you’ll put your plan into action.
- Step 4: Perfect. Your initial plan may not give you the desired result, and that’s okay. Revisit your code, continue to iterate on your plan in different ways. Once you reach the solution you’ll be proud of what you’ve built.
Something else to remember is what makes the problems you’re trying to solve more interesting is that there is often more than one way to solve them. Your solution may be different from another developer’s, and that’s okay. As a community, developers have a strong culture of collaboration. Think of open source software, which is everywhere (WordPress, the framework we use for this blog is open source, as is the language its build with, PHP. You can learn how to use both on Treehouse!).
Whether you’re new to coding or a veteran, by now you’ll also know that becoming a developer isn’t easy. It involves hard work, dedication and a commitment to being a lifelong problem-solver and learner. But, what’s also important is to back yourself and your coding knowledge. As Treehouse teacher, Kenneth Love explains, “not knowing something doesn’t make you a bad programmer. It doesn’t mean you shouldn’t be in technology or writing code. And it absolutely doesn’t make you an impostor.” Instead, know that you have the skills to solve the problem and that you’re part of a global community of programmers who experience the same challenges as you.
Not knowing something doesn’t make you a bad programmer. It doesn’t mean you shouldn’t be in technology or writing code. And it absolutely doesn’t make you an impostor.
In fact, next time you feel defeated by an error in your code and want to give up, take solace in knowing that thousands of developers are sharing your frustrations and overcoming them. Instead of being defeated, take a break from your code, return with determination and approach the problem from a new angle. Then, when you experience that rewarding feeling when your code runs error free, celebrate (you deserve it).
Now go out there, take on your next project and don’t be afraid to break your code.
Start learning to code today with a free trial on Treehouse.