In this section:
Most application development is modular, the developer creates complex systems comprised of smaller parts. In conventional development, these modules are processes (such as procedures). In object-oriented development, the modules are models of real-world objects (such as a customer or a shipping order). Each object encapsulates both data and processes.
For example, if you are developing an order fulfillment system for a mail-order clothing business, the objects might include customers, orders, and stock items. The customer data might include the ID code, phone number, and order history. the customer processes might include a function that adds the customer to a new mailing list, a function that updates the customer contact information, and a function that places an order for the customer.
Object-oriented development, because it models the real-world objects with which your enterprise deals, and encourages you to reuse application logic in a variety of ways, is a more efficient way of developing applications. WebFOCUS Maintain enables you to create applications using object-oriented development, conventional development, or a hybrid of these two methods, providing you with a flexible path.
Most applications need many objects of the same type. For example, if your business has 500 customers, you need one object to represent each customer. No one would want to design a customer object 500 times. Clearly, you need a template that defines all customer objects, so that you can design the template once, and use it often, each time you create a new customer object to represent a new customer.
The template of an object is called its class. Each object is an instance of a class. The class defines what type of object it is. When you create a class, it becomes a new data type, one which you can use to define an object, in the same way that you can use a built-in data type like integer or alphanumeric to define a simple variable like a customer code.
You define a class by describing its properties. Classes have two kinds of properties:
If you want to create a new class that is a special case of an existing class, you could derive it from that existing class. For example, in a human resources application, a class called Manager could be considered a special case of a more general class called Employee. All managers are employees, and possess all employee attributes, plus some additional attributes unique to managers. The Manager class is derived from the Employee class, so Manager is a subclass of Employee, and Employee is the superclass of Manager.
A subclass inherits all of its superclass properties, that is, it inherits all of the superclass member variables and member functions. When you define a subclass you can choose to override some of the inherited member functions, meaning that you can recode them to suit the ways in which the subclass differs from the superclass. You can also add new member functions and member variables that are unique to the subclass.