How to approach problem solving in software development
5 min read. Jan 16, 2022
As a software developer, most of the time in my day revolves around solving problems, finding feasible and sometimes quicker solutions. In my earlier days of programming, I usually used to jump onto coding part at the beginning of the problem solving phase. Without thinking critically or doing a brief analysis, I used to be in a rush to hit those keys in the keyboard. Whether my desire to write the code was stronger or the excitement to work on a new task was just really powerful, honestly, I didn't used to have control on the adrenaline rush releasing from my body. As a result, there used to be a lot of litters in my code. Though, I used to get things done but not following a good practice. However, those spaghetti code taught me a lot of lessions (ahem.. an excuse for writing bad code ).
As I gained more experience over the years, I learned that some of the fundamental steps help to ease the problem solving process in programming. The following are the 3 approaches that I follow on a regular basis while solving simple to complex problems:
1. Visualization
When we do not have an intention or a clear purpose, we wander around. I've often noticed that when I'm not sure what I want to build/develop or when I can't clearly visualize the thing in my head, then I loose focus. I wander around for hours without getting anything done. I consider that having a cristal clear intention so that you can visualize it in your mind is the key to solve problem in software development. Not only it helps you to set a purpose but it automatically provides you with set of steps to aproach the problem and solve it.
2. First, make it work, then make it right
Robert. C Martin (a software engineer and an author) talks the idea of making the code work first and then refactor to make it clean. In problem solving process, I've often got stuck hours while looking for perfect solution and thinking to make if right from the start. Not only I've lost some golden hours while doing so, but I'd indirectly gave more stress to my mind. Now, I usually start small and try to make the piece of new feature to work correctly. Then, I work towards if refining it.
3. Don't be hard on yourself and take a break
It may be a good idea to push yourself at gym but not at coding. Problem solving is a mental exercise and you can think clearly when your mind is free not while it is stressed. When I can't find solution to a particular problem after multiple attempts then I just shut down my computer and go for a walk or focus on something else when I'm at work. Then, I come back to the problem at a later time or the next day. When I take a break, the way I look at the problem changes or I've new prespective at it.
Wrapping up
Problem solving process by itself is a daunting task. Rather then beating youself up when things don't go your way, it's a good idea to lay out the problem solving steps by having a clear intention of what you want first with visualization. Then try to make it work without worrying how to make it right. Refactoring or cleaning up can be done afterwards. Lastly, don't forget to be easy and kind with yourself.
Happy coding!