Spend less time writing code and more time representing the problem statement

Spend less time writing code and more time representing the problem statement

I will share my mental model when it comes to programming software.

·

3 min read

Recently, I started learning about Data Structures and Algorithms in programming. If you read my earlier posts you'd know that I like python and I wish to be greater and greater at it.

So, while I started learning a few algorithms, I realized that how much planning the execution of the program is important before writing anything in the first place. Well, I know the understanding about planning before pursuing anything is something we already know, but I think we often misunderstand and get to actually doing things.

If not for you, but at least for me, it was that. By learning these algorithms, I realized that it will actually be impossible to solve programs in any programming language without representing the actual problem.

Now, people who are starting their coding career might understand this late or early, that depends on the individual. But for me, definitely I understood a bit late. Not much but just a bit late.

So what should you and I do in order to have the right mindset to write code? As it's very clear that we need to visualize the program that we are trying to solve or build. Trust me, literally take time to know how the code will solve the problem than writing and re-writing code by getting back to the problem statement to understand again and again.

Now most of you, including me, may have problems in visualizing. So what should you do? Grab a paper and pen, solve the model or the problem statement on it. If you think you are going somewhere closer to the answer, transfer the reasoning by writing code on your IDE. If it works, good, or get back to your pen and paper. This process is something you should get used to it as in your whole career, you will require this method.

Another thing that I do is when I read the use case that I am trying to solve, I use my pen to picturise the problem statement. Now, this is something I think everyone would do. What I feel is -

More experienced developers or programmars do such case study visualization in their heads. But for me, a pen and a paper would do now

Either this or that, planning the execution is certain before writing code. So like I was saying, painting the picture of the problem and its possible answers drive me closer to understanding the case quickly. While doing it, I list the code, functions, libraries, and resources on the paper that I may need in order to make the solution more practical than theoretical.

I hope this article helps in your ability to learn and write code. Best suggestion, go start learning Data Structures and Algorithms. I will be spending time on it every day for a while.