Glossary Flashcards
wrapping
The process of converting a primitive value to an object equivalent, using a wrapper class.
state
The values of the attributes of an object constitute its state. The state of an object can vary over time as the values of its attributes change.
A behaviour of an object in response to a message may be dependent on its state.
Example: sending an HoverFrog instance the message upBy()
message
A message is a request for an object to do something. The only way to make an object do something is to send it a message. For example, the position of a Frog object changes when it is sent the message left() or right(); to obtain information on the value of a Frog object’s colour attribute, you send it the message getColour().
A message must be in the protocol of the receiver.
May return a message answer and/or change the state of the receiver
protocol
The set of messages an object understands.
public protocol
The part of the protocol of a class or object that is accessible from outside of the class itself.
private protocol
The part of the protocol of a class or object that is inaccessible from a context outside of the class itself.
message answer
When a message is sent to an object, then, depending on what the message is, a message answer may be returned. A message answer is a value or an object; it is not a message. Sometimes a message answer is used, sometimes it is ignored. A message answer may be used subsequently as the receiver or argument of another message. Getter messages return the value of an attribute, as with the message getColour(), which returns a value such as OUColour.GREEN.
message expression
A message-send that evaluates to some value, i.e. the message returns a message answer. We also say that it returns a value.
message name
The name of a message, including the following parentheses, but excluding any arguments. For example, the name of the message left() is left(), and the name of the message upBy(6) is upBy().
message-send
The code that sends a message to an object – for example, frog1.right(), which consists of the receiver followed by a full stop and then the message.
collaboration
The achievement of a software solution using two or more communicating objects.
receiver
The object to which a message is sent.
class
A class is like a blueprint for the creation of objects and ensures that all its instances have the same instance variables and behave in response to messages in an identical manner.
class header
The line in a class definition which gives its access modifier, name and, optionally, the name of a class it extends and the name(s) of any interface(s) it implements. Example usage: public class WeatherFrog extends Frog implements WeatherClient
class method
A class method is a method declared with the keyword static and is associated with a class rather than with any of its instances. Classes are not objects so code in a class method cannot use the expression this or the keyword super. Class methods are invoked directly on the name of the class, using static binding, and so do not exhibit polymorphism.
class variable
A class variable is a variable declared with the keyword static. A class variable is associated with a class rather than with any of its instances, although each instance of a class can access its own class’s class variables. A class only ever has one copy of each of its class variables.
qualified
The qualified name of a member is its simple name prefixed by the name of its enclosing class, as in OUDialog.request. The parts of such names are separated by dots. This means that different classes can have members with the same names – the qualified names allow them to be distinguished from one another.
superclass
If B is a subclass of A, then A is the superclass of B. In the Java programming language a subclass has only one direct superclass.
subclass
A subclass is any class which extends (inherits from) another class. In Java all classes except Object are subclasses of some other class.
subclassing
Defining a class as a subclass of an existing class.
instance
An object that belongs to a given class is described as an instance of that class.
instance method
Code that is executed as the result of a message being sent to an object.
instance variable
A variable whose identifier and type is common to all the instances of a class, but whose value is specific to each instance. Each instance variable either contains a reference to an object or contains a value of some primitive type. For example, Frog objects have the instance variables colour and position. The values of the instance variables of a particular object represent the state of that object.
invocation
Executing code in a method. Class (static) methods are invoked directly on a class, whereas instance methods are invoked by sending messages to objects. Also called method invocation.
getter message
A message that returns as its message answer the value of one of the receiver’s attributes. See also setter message.
getter method
A method whose purpose is to return the value of one of an object’s attributes as its message answer. For example, the method getPosition() is a getter method that returns the value of the instance variable position held by instances of the Frog class.
behaviour
A term used to describe the way in which an object behaves in response to the messages in its protocol.
primitive data type
A set of values together with operations that can be performed on them. The primitive data types in Java provide a set of basic building blocks from which all of the more complex types of data can be built. Java’s primitive data types include int, char and boolean.
primitive type variable
A variable declared to hold a value of the declared or compatible primitive data type. Less formally we refer to a primitive variable.
int counter; // declaration
counter = 0; // initialisation
primitive value
A value of some primitive type; for example, true, -1.3, 42, or ‘x’ are all primitive values of different primitive types.
Integer types
byte - 8 bits
short - 16 bits
int - 32 bits
long - 64 bits
declaration statement
Reserves memory for a variable of some type.
int myNumber;
String myString;
reference type variable
A variable declared to hold a reference to an object of the declared type (or a compatible type). Less formally we refer to a reference variable.
Frog kermit; // declaration kermit = new Frog(); // initialisation
null
built-in literal
Can be assigned to reference variables
constructor
A programming construct, similar to a method, used to initialise a newly created object.
constructor chaining
The process whereby constructors use super() to invoke constructors higher up their inheritance hierarchy.
declaration
A statement in which memory is reserved for a variable of some type that is formed by writing the type of the variable followed by some name (its identifier).
garbage collection
The process of destroying objects that have become unreachable because they are no longer referenced by variables, in order to reclaim their space in memory. In certain programming languages, including Java, this process is automatic.
keyword
A Java keyword is a word reserved for use in the language. Keywords cannot be used as variable identifiers.
evaluate
To find the value of something. We say that expressions have a value or evaluate to some value.
expression
Code that evaluates to a single value. Expressions can be formed from literals, variables, operators and messages.