DEV Community

Sampad Sarker
Sampad Sarker

Posted on

1 1

Dry run the code before compile

What is dry run?
Tracing code manually on pen & paper.

Common mistakes in Dry run

❌ Skipping lines or skipping loop completely/half-completely.
❌ Don't track updated values of variables.
❌ Not tracing the real code rather than another imaginary code in your mind because of lack of concentration.
❌ Reading mistakes(silly mistakes like comma, semicolon , typos etc.).
❌ Conceptual lacking(not clear about execution sequence , execution context, data flow , loop execution etc.).

Good practice in Dry run

✔ Always write updated values of variables by drawing box shape . In case of loop, use table like chart to track every updated variables of every iteration.
✔ Read lines letter by letter.
✔ Evaluate arithmetic expression according to precedence rule of operator.
✔ Give enough time for dry run.

Why need dry run?

  • understand the code properly.
  • clear the coding concept.
  • find bugs easily.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay