Method (Function) Definitions
- Method (Function): a block of code to accomplish a task; used to break up a large task into smaller subtasks. Each method has a name that is used to invoke the method.
- Method Definition: the code that defines the behavior of the method; consists of the method heading and the method body.
- Method Heading: the first line of a method definition; contains the method name, the return type and the parameter list.
- Method Body: the code that provides the actions of the method; the code of the body is enclosed in {}.
- Value-Returning Method: a method that returns a value to the calling program. The return value can be incorporated into an expression. A value-returning method must include a return statement that specifies the value that gets returned from the method.
- Void Method: a method that does not return a value that the calling program can incorporate directly into an expression.
- Method Invocation: a statement that calls a method; the statement that causes control to be transferred to the first statement of the method. The method invocation consists of the method name and argument list. For example: f1(a,b,c)
- Parameter List: the list of arguments to the method given as part of the method heading. The parameter list is enclosed in () and is a list of declarations for the parameters to the method. The data type of the parameter must be explicitly specified for each parameter.
- Formal Parameter: a variable defined in the method heading.
- Actual Parameter: a variable or expression that is used in the method invocation. The value specified in the method invocation will be substituted for the corresponding formal parameter when the method is executed.
- Return Value: a value computed on the return statement that represents the value that will be returned to the calling program.
- Value Parameter: a parameter whose value will be copied into the called method. The value of this variable in the calling program will not be altered by the actions of the called method. A variable, constant or expression can be used as a value parameter.
- Local Identifier: an identifier that is defined within a block (usually a method) and can only be referenced within this block.
- Data Flow: the flow of information between the components of a program. Data can be shared by different program modules through the parameter list, return values and global variables and constants.
- Control Flow: the sequence in which program statements are executed.
- Preconditions: a set of conditions that must be set in order for the method or loop to execute properly.
- Postconditions: a set of conditions that are set as a result of the execution of a loop or method.
- Interface: the shared boundary between program elements. The method heading and preconditions/postconditions represent the interface between the method and calling program.
- Variable Scope: the region of the program where the variable is known (local or global).
- Scope Rules: the rules that determine where in the program a variable can be referenced.
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2013