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

The goal of this unit of code is to create a pizza from an order. There are no observable side affects. To verify the correctness of this unit of code, the only requirement is to map all inputs to outputs. Any assertions other than that mapping are not requirements to test correctness.



Yes, and I can create an even larger 'unit' of code around it, declare that it has 'no observable side effects', and claim that `createPizza` is just an implementation detail of that, and therefore needs no testing.


Maybe? We don't know about the other code. Most code I work with would be sticking this output in a db or email or something, so any larger piece can't be isolated, so is no longer a single unit. It's about isolation from side affects, not how much code you can stick behind a single method call.




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

Search: