Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> a lot of nested "ifs" with "returns" sprinkled around

how do you feel about the code smell of a tail-recursive fizz-buzz?



If it's in a language with guaranteed tail recursion optimisation and it's idiomatic in that language (these two things often go together) then fine, seems reasonable, Go With God.

Otherwise, nope, I don't care that "I checked and it's optimised correctly". We do not write optimiser dependent code in my house, write something that won't explode messily when we change target or upgrade the tools or whatever and now it stack overflows.


Erase it and do it iteratively like any sane person!

Kidding aside, I'm more talking about the kinds of large procedures common to C++ codebases. These involve many sequential state changes which leave lots of opportunities for not initializing things and the like when the right set of conditions are met. The more paths available through this kind of code the more likely it becomes we'll create a bad one and fail to anticipate the conditions which trigger it.


Smells like breakfast




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: