Testing Code: From Spaghetti to Safety

Greg L. Turnquist
5 min readFeb 26, 2023

The world of software development is constantly evolving. New tools, techniques, and technologies are being introduced every day, and it can be challenging to keep up with the latest trends.

However, there are some issues that never seem to go away, no matter how much progress we make: legacy code.

Yuck.

Can I get a high-five if you’ve ever dealt with legacy code?

Legacy code is something we’ve all had to had to deal with at one time or another. The code may be poorly documented, contain chunks of commented-out code, or have no comments at all. Often, there are few automated tests, making it challenging to know if the code is working as intended.

So, what do you do when you find yourself in this situation?

Easy: Start testing.

What??! That’s your whole thing? “Start testing?”

Let me clarify. It’s easy WHAT you must do and that’s to start testing. Before you alter any features, if possible, if you can hold off the minions of management and community and before you “fix” a single thing and first write a test case, that would be perfect. (I understand if you can’t.)

But deciding to “start testing” will not be easy to CARRY OUT. Believe me, I know.

In fact, it will be very VERY hard. So continue reading if you want to some tips that at least give you a decent shot and moving that boulder up the hill.

--

--

Greg L. Turnquist

Sr. Staff Technical Content Engineer at CockroachDB • YouTube Content Creator at https://youtube.com/@ProCoderIO • Best-Selling Author • Coffee Lover