Hello DEV community ππ
I always wonder how I can improve my thinking and logic in programing? When I face a new challange I always freeze for a long time before I came up with the solution and start to code. I'm not thinking, I'm FREEZING. How to think and plan for my code?
Top comments (6)
That is a hard question.
I personally believe that everyone has their own process. Perhaps freezing is yours, but the important part is not to get frustrated. You can do pseudocode exercises, listen to different kinds of music while you code, so that your mind gets a different rythm.
The tips I give you are:
By writing it down.
Write your input and outputs first on a piece of paper.
then write down each step you need to do on the input to get the desired output (the part you can be very general or can go in detail). This has helped me not only do i understand the flow but also get to know if there are more effective ways or a different logic i can apply.
it may sound time consuming but its much better than just being clueless in the middle of coding, trust me its doesn't take a lot of time too.
The best advice I can give is to get more experience. As you solve more and more problems you'll find solutions that you will be able to re-apply in various situations.
I would give Codewars a go. It provides you with coding challenges that help you to improve your logical skills. codewars.com
If you find them difficult to start with, don't panic it's fine. You can look at other peoples solutions and over time you will learn the patterns to look out for and it will become muscle memory.
Thank you all guys for your answers. @jhordan92 @rinisimon @georgehanson
Forgive me if I sound like a stupid right now but can anyone give me an example.
Let's take this example from Eloquent Javascript:
I want to know how you gonna planning for this code, How I'm gonna know how many variable I'm gonna use, What's is step #1 and so on.
Thanks.
This Video might help you
That video is excellent! Thank you so much for sharing. I'm going to encourage my team to watch it.