Creating Functions

New Terminology

class
Container the holds the template for objects
object
Complex container created from a class
constructor
The method which initializes an object as it is created (instantiated) from the class
instantiate
Create a new object from a class. The new object has its own state and methods
void method
A method that carries out an action and returns nothing
value returning method
A method that carries out an action and returns a value to the calling program.
invocation
Calling a method during program execution
qualified name
An identifier which uses the name of a class or an object to specify the location of the identifier.
pass by value
A term which describes the process of passing an actual parameter to a formal parameter in which the value of the actual parameter is copied into the formal parameter container.

Programming specific structures and terms

method header
The introduction of the method. The header contains all of the information the compiler needs to use the method.
method body
The code that carries out the action of the method.
method modifiers
The keywords of public and static which identify the visibility and the useage respectively
return type
The datatype of the value returned by a method. In the case of a void method, the datatype is replaced by the keyword, void.
method identifier
The name of the method. By convention, method identifiers begin with a small letter and use capital letters or underscore characters to separate words.
formal parameter list
The list of variable declarations that accept values from the calling program into the method.
return
A keyword in java that signifies the beginning of a return statement.
@param tag
The tag (one per formal paramter) which describes the method arguments
@return tag
The tag that describes the return type of a method. Not used in the case of a void method.

Class notes

  1. Design issues for methods.  Looking for patterns...chunking a program into functional units.  Who are the players? Example.java
  2. What is a method? n14.ppt
  3. SimpleMethod.java
  4. Creating a method in a different class. (SimpleDriver.java, SimpleContainer.java)
  5. DeepAndDeeper.java
  6. PassArg.java
  7. PassString.java
  8. ValueReturn.java
  9. LocalVars.java
  10. Documenting methods
    1. @param tags
    2. @return tags
  11. Preview tomorrow lab