Writing tests will save you time.

Sangil Yun
1 min readSep 5, 2020

Learned the importance of writing tests the hard way.

Photo by Austin Distel on Unsplash
  • Context — Tight deadline.
  • What I did — Skipped planning code architecture, skipped writing test and tried to reuse one component for different places.
    Don’t get me wrong, there is nothing wrong with reusing components. In fact, trying to make well-designed reusable components help us to write better software. But what I ended up doing was making one generic component that’s overly complicated.
  • How did it go and what went wrong — Because I was reusing one component in 3 different places with slight style modification, one fix here broke something there. The code got harder and harder to maintain.
    Adding the component in Storybook could’ve helped.
  • Take away — Plan carefully before you write code and write tests to make sure what you just wrote works. Having tests that will tell you if something breaks will make it easier to focus on the next task, without worrying that the new code or the changes you make might break what you’ve written.

--

--