Jason Knight
Oct 11, 2021

--

See, this too is something I would have been taught is ADDING code smell.

Not your adding error reporting, that's a good thing. But by passing an error message as a parameter regardless of if there's an error or not, you're creating memory thrashing / garbage collection headaches and wasting execution and parsing time on code that may or may not be run.

I know the "functional programming" nutjobs love this type of stuff, but to be frank this is a case for either having your assertEquals method either handle that **** internally, or to have it return if there was an error or not for a local IF statement to handle that.

Blindly passing the success or error message does not provide logic clarity. A lack of visible logic is code smell, no matter how many of the FP whackjobs cream their panties over it.

--

--

Jason Knight
Jason Knight

Written by Jason Knight

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse

Responses (1)