Problem Solving in a Nutshell
In this little blog post i want to explain to you how i approach problems and the way i took to solve them. Problem Solving is the most important skill you can acquire when you want to be a better developer.
I dont say that these techniques i will introduce to you are the only way to tackle problems. I just want to share how i approach problems and maybe this will help you in the long run.
When you face a problem that is huge you may just jump into the code and try to solve it right away. At least this is the way i did it when i started programming. Oh boy that was not my best idea. I learned quickly that this may not the best way to tackle big problems. Then i evolved and after some practice i realized i need to think before i code. This worked a lot better and yes i cracked some problems this way. I started to think about the problem and all possible solutions before i started coding. I even started to make notes (digital and hand-written).
It worked quite good. But after i read some articles about this topic i realized i need to do one more step in the process of problem solving.
Split one big problem in multiple smaller ones
So simple but so damn effective!
Little problem chunks
It was a game changer. It was simple and easy.
I needed to repeat the process of thinking, sketching and coding for each chunk of the problem. One big problem is hard in the beginning. Like where do i start? How the hell i start? Which file? Which code?
Little problems have the advantage of being easy. Or at least much more easier than the big problem.
7 steps to solve a problem
1: Write the problem down
First of all we need to be aware of the problem. The process of writing it down will help you to get a better understanding of it. You can do it on your PC/Laptop or take hand written notes. You can even do both. Im using roughly 80% e-notes and 20% hand written notes.
2: Divide the problem in chunks
This step is crucial. By dividing the problem in chunks you have to understand it in the first place. This means when you are ready to divide it you already understand (roughly) what is the problem.
3: Search the web
One of the things we developers are very good at. Use google (or any other search engine). StackOverflow is like a second brain. Use it. Just take this in your mind:
Dont just copy answers blindly into your code. Often the code will work just fine but sometimes you have to adapt it to your project and for that you have to understand it. Always think about the code and why its written the way it is. This will massively help you in the long run and make you a better developer.
4: Solve one chunk at a time
Often i catch myself at jumping between multiple chunks. I have to remind myself that this is uneffective. You want to focus on one problem chunk at a time. Sometimes one chunk is related to another chunk. Jeah this will happen. And this will be the time where we have to jump back to point 2 und divide in even further or just a little different. One chunk needs to be stateless. It should be independent.
5: Combine the chunks to solve the origin problem
When i solve all the little chunks of the problem its time to assemble them to solve the big problem. This is a skill that will evolve with practice. If you divide it in logical chunks this will be easy.
6: Save all notes you take to solve the problem
Important Take notes while solving the problem and save them in a single space. I use Notion as my note taking system tool. Choose yours and stick with it. Your future self will thank you!
7: Share your knowledge
I enjoy to share my knowledge i gained with you. Its fun and helps me to solidify it even more! And on top of that i may help others. The developer community is amazing and im proud to be a part of it!
Thats it. Dont be afraid of big problems. Take them! Its a great oppotunity to learn. I hope you find this article useful in some way.
I love to talk about stuff like this so feel free to leave me a comment.
Stay connected to me and my content on Twitter.
Stay healthy guys and see you next time!