Skip to content

· 1 min read

Whenever you encounter a bug

Placeholder

Write a test first

Encountering a bug after development means your tests aren’t good enough. (or you weren’t doing TDD 😉)

To make sure the bug doesn’t repeat, write a test for it.

By writing a test, you’d have simulated the exact situation where the bug arose.

When you fix the code, you know the bug is perfectly fixed. And anyone modifying the code in the future won’t miss it.

Make sure right things are logged

Logs should provide accurate enough description of the state of the system.

If it takes you too long to find the cause of the bug, it maybe that your logs aren’t good enough.

Get new posts by email

No spam. Unsubscribe anytime. Or grab the RSS feed.

Mailto-based for now. ButtonDown / ConvertKit can replace this form later.


Comments lazy-load on scroll. Prefer GitHub? Giscus activates once PUBLIC_GISCUS_* env vars are set (see Giscus.astro).

Index

Index

Back to Blog