Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Handlestuffandwritetofile() is a total mistake (harunurhan.github.io)
2 points by harunurhan on April 19, 2014 | hide | past | favorite | 2 comments


> Routines should have only one purpose, If a routine does more than one thing then it is better split it into individual routines.

Yes, unless the routines's purpose is to decide which action should be taken, and unless each action is so small that branching to other routines is inefficient. I can't count the number of times I've seen someone pontificate about a rule that isn't a rule.

If the OP's views had merit, there would be no switch statements or function hashtables.


a routine that makes decisions on what action should be taken can still have a good name, like "routeOrder" or "dispatchWork". In C, inlining works if you are really worried about fn call overhead. No problem with the notion here, just... its 2014 not 1990.




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

Search: