Terminology review

Classes, properties, and methods

In object-oriented programming, you create reusable classes to perform application processing. These classes include properties and methods that define the class’s behavior. To perform application processing, you create objects, which are instances of these classes. PocketBuilder implements these concepts as follows:

The rest of this chapter uses this PocketBuilder terminology.

Fundamental principles

Object-oriented programming tools support three fundamental principles: inheritance, encapsulation, and polymorphism.

Inheritance Objects can be derived from existing objects, with access to their visual component, data, and code. Inheritance saves coding time, maximizes code reuse, and enhances consistency. An object derived from an existing object is called a descendent object or a subclass.

Encapsulation An object contains its own data and code, allowing outside access as appropriate. This principle is also called information hiding. PocketBuilder enables and supports encapsulation by giving you tools that can enforce it, such as access and scope. However, PocketBuilder itself does not require or automatically enforce encapsulation.

Polymorphism Functions with the same name behave differently, depending on the referenced object. Polymorphism enables you to provide a consistent interface throughout the application and within all objects.

Visual objects

Many current applications make heavy use of object-oriented features for visual objects such as windows, menus, and visual user objects. This allows an application to present a consistent, unified look and feel.

Nonvisual objects

To fully benefit from PocketBuilder’s object-oriented capabilities, consider implementing class user objects, also known as nonvisual user objects:

Standard class user objects Inherit their definitions from built-in PocketBuilder system objects, such as Transaction, Message, or Error. Creating customized standard class user objects allows you to provide powerful extensions to built-in PocketBuilder system objects.

Custom class user objects Inherit their definitions from the PocketBuilder NonVisualObject class. Custom class user objects encapsulate data and code. This type of class user object allows you to define an object class from scratch. To make the most of PocketBuilder’s object-oriented capabilities, you must use custom class user objects. Typical uses include: