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

> Even the correct version is not that good. The multiple checks on nil is an obvious pattern and as such should be abstracted away.

From a pedagogical point of view, showing the first transition from the anti-pattern is a good practice, because once you learn that, those first transitions are composable. So, while I agree that the correction for this isn't the best end-state, its an appropriate way to show how to correct the nested-conditionals-with-error-returns anti-pattern.



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

Search: