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

The linear version is hard to test. The split-function one is much more testable. There is also that thing called complexity, which increase with function length and has been proved to correlate with bugs count.

The problem with the example is that it is both extremely artificial and shows a single use case. Even with the artificiality, one can easily imagine baking a calzone instead, which could reuse all the factored-out oven functions in the split version.

(The comment about pizza vs baked pizza is one about using typing to encode your logic, but is separate from the issue that your functions should do one thing.)




Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: