Table of contents
Introduction
Solving programming problems on LeetCode or CodeWars can get tough. Fixing the errors in your web app can get tough. Scaling your mobile app can get tough. How do you deal with getting stuck all the time as a developer? Believe me, if you do get stuck, it means you were doing something right and giving your best until you messed up. View it as an opportunity to grow. But as a developer, the solutions you get arise from your thought process. So here's the thought process that has helped me in solving programming-related problems and challenges.
The GIVA Framework
Given. Imagine. Visualize. Actualize. GIVA.
This is a concept that many of you might already be using unknowingly. It's a problem-solving approach to help you determine the best way to move forward or get around obstacles. Here's an explainer.
Given: This is the stage where you need to identify what the problem states. You need to understand the inputs that have to be supplied and the outputs that must be obtained. You understand the conditions, specifications and other nitpicky details about the problem presented to you. If a CodeWars' Kata asks you to sum up two numbers (that's tough!), you need to understand the inputs passed to the function, the outputs you need to return (the sum) as well as any time or memory constraints.
Imagine: In the Given stage, you identify the problem. In the Imagine stage, you find ways to solve the problem. You list every damn way you've come up with of solving the problem. Unfortunately for us, to sum up two numbers, there's only one such method :(
Visualize: In this stage, you pick one of the ideas or methods you've thought about in the Imagine stage and you simply visualize how you'll implement it to solve your problem. For developers, this can mean noting down pseudocode, which can be pretty hectic and will make you feel unproductive, but will be better for your growth in the long run.
Actualize: This is the stage where you implement your visualizations or pseudocode and test if it works. If it does, thank me later. If it doesn't, Go back to the Visualize stage, use one of the different ideas from the Imagine stage and Actualize it again. If none of the ideas found in the Imagine stage work, imagine again, or ask for help. Asking for help is one of the greatest self-improvement habits for those looking to take their skills, in any field, to the next level.
Conclusion
I find GIVA to be one of the simplest problem-solving approaches of the 21st Century (probably an exaggeration). If you have any thoughts, good or bad, about this beautiful framework that I have presented to you, the reader, then please give me feedback in the comments section!
Thanks for reading! Again, any feedback is appreciated in the comments section and if you enjoyed reading this article, consider reading more of my articles on my blog page about JavaScript and programming in general.