Please enable JavaScript.
Coggle requires JavaScript to display documents.
Topic 5 : Methods and Data - Coggle Diagram
Topic 5 : Methods and Data
Methods (procedures)
Method = set of programming statements that an object can execute
consists of a sequence of statements to perform an action, input parameters, possibly an output value
method categories in Alice 3
1) Primitive – built in
2) User-defined – not yet exist, additional method by the programmer
characteristic in Alice 3
1) Procedure – no return value method
2) Function – with return value method
Primitive Procedure
methods that have already been created for the user and there are built-in the programming language.
Function
special type of method
set of instructions that cause some action to take place
Data and Expression
Data = input then will be processes and output as the information
Variables
is a storage location that is represented by a name
Type of variables in Alice 3:
1) Local Variables: belongs to a specific method.
can be used only by the instructions in the method that the variable belongs to
2) Parameter Variables: is used to hold an argument that is passed to a method when the method is called.
3) Class-Level Variables: is like a property that belongs to a specific object
4) World-Level Variables: is like a property that belongs to the world
Data type
1) DecimalNumber
2) WholeNumber
3) Boolean
4) TextString
A math expression performs a calculation and return a value
Parameters
Each method is its own small block of instruction
used to communicate with a method.
communicate values (e.g: number, string, name of the object) from one method to another method
Parameter Variables - hold an argument that is passed to a method when the method is called.