DEV Community

loading...

Discussion on: Refactoring the Worst Code I’ve Ever Written

Collapse
gypsydave5 profile image
David Wickes

Great post Jacque - it definitely looks cleaner in the end (and less brittle to boot).

Just wondering though - you've performed this refactor, but you've not mentioned how you knew you weren't changing the behaviour? Were there automated tests surrounding the code, or were you executing the code with some sample data and comparing the results manually, or were you doing something else?

Collapse
jnschrag profile image
Jacque Schrag Author

Thanks so much!

Thanks for pointing out this omission. This particular project doesn't use tests, so my comparing the before/after code was done by manually checking the final dataset object and the returned UI on the data viz. It was definitely more tedious than it could have been if I had also added tests. :)

Forem Open with the Forem app