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?
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. :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.