Interrogative message - asks the target object to reveal something, e.g. what is the current balance of the savings account. The target object is obliged to respond to the sender
Informative message - tells the target object something of interest, e.g. stock levels have fallen below 200. The target object does not respond to the sender, however it may do something in response to the notification (e.g. order more stock)
Imperative message - requests the object to take some action on itself / another object / the environment around, e.g. asking an ATM object to dispense cash
The 'this' reference
The keyword 'this' refers to the object which is executing the statement at that point in time (i.e. self).
E.G in a constructor, 'this' refers to the object which is being constructed.
Object Relations
A link is a connection between object instances
An association is a connection between classes - an association is an abstraction of all likely links.
Wrapper Classes
ArrayList class can only refer to a collection of object type - it cannot refer to a collection of a primitive type, e.g. int
The Wrapper Class exists to allow a primitive type variable to behave as if it is an object, e.g. converting itself to a different format, or passing it as a parameter to a method expecting an object.
Each primitive data type has a corresponding wrapper class. All classes are public final, i.e. they cannot be extended.
Auto boxing
Primitive type data is automatically converted to object type when required via the auto boxing process. The reverse process (i.e. obtaining a primitive value with the same value as the wrapper objects) is known as auto unboxing.
Auto boxing occurs when inserting primitive type data into an Arraylist, and auto unboxing occurs during access to the ArrayList.
Inheritance
- Technique for reusing existing classes as the basis for defining new classes, which add additional behaviours, or which modify the existing behaviours of an additional class
- The class used as the bases is the superclass
- The class which extends the superclass is the subclass
- e.g. Employee is the superclass, Programmer and Team Leader are the subclasses
- Inheritance introduces a form of coupling, as the subclass is affected when the superclass is changed
Generalisation
Taking a group of classes, determining commonality, promoting commonality to form a superclass, which is a general form of the existing classes
Specialisation
Developing a new class based on an existing class, i.e. creating a special form of the existing class
Overriding Methods
Write a new implementation of a method defined by an ancestor class (superclass, or the superclass' superclass). Overriding is where the method has the same set and order of parameters as the ancestor class.
Polymorphism
The principle that behaviour can vary in response to a message being sent to an object through a reference variable, depending on the actual type of object which the variable is referring to at the moment the message is received.
e.g. in the bank system, until the program is run (compile time) and the user selects the bank account, the withdraw method may vary
A polymorphic variable is a reference variable which is capable of referring to objects of a variety of types. The restriction is that the types to which it may refer must be descendants of the class type used in the declaration e.g. BankAccount currentCustomerAccount;
i.e. only objects of type BankAccount or any of it's subclasses may be assigned to the variable
Protected Access Modifier
Things which are marked as protected are accessible to any class in the same hierarchy - i.e. all ancestors and subclasses
Exception Management
Check Exceptions - Invalid conditions outside the control of the program, such as user input
Unchecked Exceptions - Defects / bugs in the program, i.e. logic errors
Unchecked Exceptions - Defects / bugs in the program, i.e. logic errors

