Insist on Correctness
Understand the importance of distinguishing pure functions from impure code to improve testing and correctness. This lesson guides you to isolate code tasks, manage side effects, and handle legacy code effectively to produce reliable software.
We'll cover the following...
We'll cover the following...
In toy programs, it’s easy to tell the difference between correct and incorrect. Does factorial(n) return the correct number? That’s easy to check; one number goes in, and another number comes out. But, there are potentially many inputs in extensive programs, such as state or function parameters, and many outputs or other side effects. That’s not so easy to check.
Isolation and side effects
Textbooks and some courses ...