Pop Quiz 1
Give an example of a trade off between reliability and cost of execution.
- Exception handling - You sacrifice cost of execution by enabling exception handling but increase program reliability, particularly important in the case of embedded systems.
- Recursive methods - Recursive methods may often be more reliable than iterative methods, but you will sometimes sacrifice performance using a recursive method as there can be much more overhead involved in pushing multiple method calls to the runtime stack.
- Dynamic typing - Utilizing dynamic type checking will favor the cost of execution but sacrifice reliability if the program runs into a type check error during runtime.
- Array bounds - Bound checking on arrays. If the bounds are checked invalid memory accesses can be caught but slow down execution time (it has to check the bounds for every access to the array).