Skip to main content

This should never happen

How often do you see comments like "This should never happen" in a software codebase?

If that's true, why is it there?

If it truly should never happen, the additional code only adds more noise and distracts from the code that is run.

You can add a test that checks a method isn't called, but what value does this offer?

If it doesn't happen or some code isn't run, remove it and keep it as simple, clean and easy to understand as possible.

Was this interesting?

Subscribe to my daily newsletter for software professionals on software development and delivery, Drupal, DevOps, community, and open-source.

About me

Picture of Oliver

I'm a certified Drupal Triple Expert and former Drupal Association staff member with 18 years of experience, a Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.