|
The previous unit described the 'small' programming structures that languages such as
Java offer. We have been concerned largely with how we store and operate on data, and
how methods achieve their purposes. In this unit, we aim to show that Java is truly an
object-oriented language. Object-oriented languages provide better support for what
can be called 'programming in the large', a very different skill to the kind of
programming of Unit 2.
The key object-oriented structure is the class, with its definitions of methods and
variables. At the 'large' level, we are also able to describe relationships between
classes, such as inheritance.
Programming in the large is about specifying how the parts of our programs should work
with one another, and object-oriented languages provide us with keywords that allow us
to reason about how methods may be used, how data may be manipulated and how
objects may 'communicate' with one another.
Another key topic in this unit is the issue of how to create objects from class definitions,
specifying the starting state of the objects in detail.
It is not difficult to write Java programs in a way resembling those of older, non objectoriented
programming languages. However, to do this would miss the point and lose
much of the power of the language. To derive the most from Java it is necessary to
develop object-oriented code. By the end of this unit, you should be able to do this. |