DEV Community

Cover image for Worth the 5 Minutes
Rini Simon
Rini Simon

Posted on

Worth the 5 Minutes

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.

Hence,

  • 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

Top comments (16)

Collapse
 
iskndrvbksh profile image
Baba

i use draw.io for a long time and it gives me 'birds view'

Collapse
 
hdv profile image
Hussein Duvigneau • Edited

Same. I find it so much easier to navigate flow charts than paragraphs of textual documentation. I'm sure other people with dyslexia on the team would also appreciate it.

That said though, if a function becomes so convoluted that you find yourself needing to document it like this, it's usually time to break the function up. Keep the flowcharts to plan and/or map out the bigger picture.

Collapse
 
rinisimon profile image
Rini Simon

I know about the tool, but never tried it, will try it out.

Collapse
 
hdv profile image
Hussein Duvigneau

This is the first step to good unit testing practice.

Once you've got into the habit of breaking down a routine into a set of discrete functions, clearly defining what the inputs and outputs should be, it's not such a big leap to habituate writing the unit tests which enforce the function's role.

Collapse
 
kristijan profile image
Kristijan

Simon, thank you so much for this post! I started learning to code 5 months ago. Learning theory is going good, but i really have problem putting into the practice. Your post really encouraged me! Thank you!

Collapse
 
rinisimon profile image
Rini Simon

Hi! I have been there and i know how it feels, just hold on and don't give up. Don't stop practicing, practice is what makes you better when it comes to coding and errors is what teaches you. Am really glad my post encouraged you. All the best!

Collapse
 
l0x0s profile image
l0x0s • Edited

Hi Rini, thanks for the article.
could you give a real example ? I'd be curious to see how details you are in your steps and if you're more desbribing feature step or technical step .

I agree with you , with experience I tend to spend more time thinking about the code before starting than younger where I wanted only to be in code (I needed a lot of issues and dead-end to realize thinking before code is useful ! )

Collapse
 
rinisimon profile image
Rini Simon • Edited

I do agree with you, for me as I learnt I stopped writing most of the details because I was aware of them in my head. This is a small example of what I do, I do keep adding notes to it on the go. Hope it helps.

alt text

Collapse
 
madhavgupta profile image
Madhav Gupta

I so need to do this,I take it all in my mind and not write it sometimes, ends up getting confused in the middle of process,great read..Thanks.

Collapse
 
rinisimon profile image
Rini Simon

Writing it down gives you a better understanding and helps you align your ideas. I am glad you liked the post :)

Collapse
 
karaluton profile image
Kara Luton

Love this! I take a similar approach and it's really helped me think through exactly what I need to do when I'm having a block.

Collapse
 
rafalpienkowski profile image
Rafal Pienkowski

This guideline nicely follows the ”think twice, do once” rule.

Collapse
 
rinisimon profile image
Rini Simon

Yes, even if your not ready to think twice, you kind of are ticking yourself to do so.

Collapse
 
davidhbolton profile image
David-H-Bolton

Inputs, outputs and the bit in the middle was how Jackson Structured Programming used to be described. It's a bit more than that. en.wikipedia.org/wiki/Jackson_stru...

Collapse
 
steelwolf180 profile image
Max Ong Zong Bao

Hahaha, this is exactly what my boss is asking me to do when he is giving me advice on time management. Honestly, it feels kind of hard to do to start.

Collapse
 
rinisimon profile image
Rini Simon

I was very reluctant too but i did give it a try and trust me its not that difficult at all. Eventually i have seen a change in my perspective, the way i approach a task. so just try it, nothing there is nothing to lose. All the best :)