Object-Oriented Concepts and Constructs

Class, object, method, message, instance variable, and inheritance are the basic concepts of the OO technology. OO metrics are mainly measures of how these constructs are used in the design and development process. Therefore, a short review of definitions is in order.

Figure 12.1 provides a pictorial description of the OO structures and key concepts. For example, "Account", "SavingsCheckingAccount", "HomeEquity", and "CertificateAccount" are all classes. "Account" is also an abstract class; the other classes are its subclasses, which are concrete classes. "Ken Brown'sSavingsAccount" and "Ken Brown's HomeEquity Account" are objects. The "Account" class has three subclasses or children. "AccountNumber" is an instance variable, also called an attribute, and getBalance() is a method of the "Account" class. All instance variables and methods for the "Account" class are also the instance variables and methods of its subclasses through inheritance. The object "Ken Brown'sSavingsAccount" sends a message to the object "Ken Brown's HomeEquity Account", via the "transfer()" method and thereby invokes the "setMonthlyPayment()" method. Therefore, the class "SavingsCheckingAccount" is coupled to the class "HomeEquity" through the message.

Figure 12.1. An Object-Oriented Class Hierarchy

Категории