Hacker News new | past | comments | ask | show | jobs | submit login

Often its better to have 5 pieces of code that look alike, then to have a function that has 5 different cases. And the former will be easier to modify and delete.





Not when you modify state in the same scope. You now have 5! (120) ways of introducing bugs, if you just wrote it as a function that doesn't modify global state you only have 5 ways of creating bugs.



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

Search: