2 ms·
I don't write ruby at all, but this is how I write my Java, Kotlin, and Javascript; fail-fast at the top of the method, with the happy path following. And I'll
by thomascgalvin 4y ago
I don't write ruby at all, but this is how I write my Java, Kotlin, and Javascript; fail-fast at the top of the method, with the happy path following.
And I'll take it one step further: I see a multi-line branch as a code smell in and of itself. If something in a branch takes multiple statements, I am of the opinion that the body of that branch should probably broken out into a method.
So if we're going off the article title, my code might look something like
val isNotRubyDev = !user.isRubyDev
if(isNotRubyDev) return
// ...read article