您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes
Introduction
Content
Apply
Reflect
Extend
previous.gif
 (3087 bytes)
next.gif
 (2959 bytes)

 
 
Content Index
Content Page # 3

Classes and Objects

Classes in modelling and programming

It is important to realize that classes have two related meanings in software development. First, a class is a modelling construct, that is, a way of representing entities in the real world. In the `analysis' stage of software development, the developer may build a model of the system to be developed based on classes. Classes are also programming constructs, that is, units of organization of a program. Ideally there should be a strong correspondence between these two views: classes in the model should correspond to classes in the program. In practice the correspondence is rarely one-to-one; the programmer will usually have to introduce additional classes to support the operation of the program at the technical level. The Java `String' class is an example of this use of a class.

In modelling, classes can be concrete or conceptual. A concrete class is one that represents a physical object in the real world. Here are some examples:



A conceptual class is one that does not have a physical presence. Here are some examples:

  • a bank account
  • a mortgage
  • a musical recording
  • a picture
Note the difference between a musical recording, which is conceptual, and a compact disk, which is concrete. In everyday speech we happily mix these up. We may talk, for example, of 'playing Beethoven's fifth symphony' and not, 'playing the compact disk which embodies a recording of Beethoven's fifth symphony'

However, if you were designing software to catalogue a large music library, you would have to ensure that the difference between these concepts was perfectly clear in your mind. This concept is considered in more detail in the 'discussion' topics.
 

Exercise 1 — Examples of classes

Although there is a good correspondence between the use of classes for modelling and the use of classes to organize a computer program, historically these uses of classes have been developed by different people, and use different terminology. The Unified Modelling Language (UML) has started to impose a standard terminology on the modelling use of classes, but the use of classes in programming is still subject to a variety of different terms. There is a summary of the terminology used in object orientation at the end of this unit.

Back to top

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright © 1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg