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

I even think this conflates 'clean' with 'duplication'.

The first code is clearly 'clean' conceptually, although there's plenty of duplication, it's very clear what's going on, it's 'flat'.

The re-worked code with an abstraction is more complex, even though it's 'tighter' in some way, it's suddenly multi-leveled, and so less clean conceptually.



I think we should stop stretching the word "clean" to encompass everything we approve and disapprove of in code. Your discussion of the underlying issues is perfect - the author's coding dilemma is a classic tradeoff between the complexity of repetition versus the complexity of abstraction. "Clean", if it means anything at all, is not the dimension on which these options differ.

I elaborated on this in a separate comment here: https://news.ycombinator.com/item?id=38568178




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

Search: