Excerpts from the Introduction:
An object is a separate, self-contained, encapsulated entity, and the term encapsulation is important in OO. This means that an object has data that it can keep private from the outside world and that it has specific behaviour. It manipulates its data and implements its behaviour through its methods.
Writing the code that defines an object's methods has many similarities with structured programming, and so uses many structured programming principles such as structured selection (If..then..else, Case) and repetition (While..do and For loops).
In this module we assume that students are familiar with these concepts and so concentrate on principles that apply specifically to OO programming.
Delphi as a Learning Environment:
This course uses
Delphi to teach object orientation. Delphi's roots lie in
Pascal, and so it has a sound, structured foundation. It is also strongly object oriented and provides many OO characteristics such as class inheritance, static binding and dynamic binding, and reference semantics.
The module makes extensive use of graded, worked examples to give students hands-on experience in the implementation of OO code. This helps to bridge the gap between the seemingly simple OO principles and the ramifications of these principles in practice. Through the inductive sequencing of concepts and through the extensive use of worked examples, this module strongly supports independent study, and has been prepared with distance learning students in mind.
In the first two chapters of this module we use Delphi's RAD facilities to start exploring various aspects of OO.
Then we apply these same principles to code that we ourselves write. We start exploring how to define and instantiate classes by looking at the way Delphi builds up a 'Form', which is the name Delphi uses for a window in a graphical interface environment.