I have been coding for a few years now and there was a time when I struggled with a issue. Let me explain.
It was hard for me to start writing code, I dint know where to start or I would start only to stop in the middle somewhere because I was anxious and just dove right in, this was not because I dint know how to code. It could be the fear of coding, just the lack of understanding or experience . No matter what it was I needed to get over it
This post is for the ones like me.
On one occasion one of my dear friend taught me this small ritual. You might probably find it silly but I do assure you on its benefits. Whenever a task came my way the first thing I do is, open my notepad(editor) and write it down. That's it, it was a simple advise.
What did I write down:
- Top of the page: write down my inputs.
- Bottom of the page: write down the desired outputs.
- In the space in between: steps needed to get to the output. You can go as detailed as what objects you want to create, or the next functions you want to write, that’s totally up to you.*
You might tell “hey! this is a flow diagram/flow chart”. Oh well, it is if you say so, minus all the rules and symbols.
Many of you might be reluctant like I was BUT, let me tell you its benefits.
A better understanding on the data (i.e. inputs & outputs), half the battle is won right here, I say so because knowing the data's behavior gives us a fair outline on what needs to be done to achieve the output and make us aware of the possible risks.
Also, this decreases the coding time, since it helps filter out the noise from the signal and make us aware of the important details that we need to handle, it deceases chances of surprise issues.
It’s a guide telling us the next step that needs to be done, could be the next function that need to be written or the next manipulation to be performed on the data.
Trust me when I say this, it cuts the shabby work and makes the code neat and tidy (one of the most common complain on a beginner is untidy coding ummmmm).
It makes you mindful about all the alternative routes you can take and helps simplify the complex tasks.
Even if you don't struggle with this issue, this approach gives you a very good understanding on the task, helps you answer the questions you had when you first read the task or maybe raise questions that need answers.
I am not saying this is more important than writing actual code but from being a beginner, it definitely helps examine the task at hand even better and get to the point faster without over looking the important details. Totally worth the five minutes.
photo by : Rini Simon