This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Changes to the design recipe to accommodate mutation Mutation allows for functions to do more than algebraic manipulation of their arguments. In particular, a function can change the value of a variable, or can have other side-effects. This is explored in some depth in Section 36.4 of How to Design Programs . These are the elements of the modified design recipes for programs using mutations: • State variables are the way that we store the values which may change over the execution of a program. For these variables, if they exist, define them and give them a value. (The state variables used in Assignment 5 are provided in the interface file.) • The contract should describe the consumed value(s) and the produced value(s) of the func- tion. Use ( void ) to indicate that the function has no consumed values, and use ( void ) to indicate the function has no produced values. • The purpose of a function should describe what the function consumes and produces....
View Full Document
- Fall '09
- Computer Science, Expression, Return statement