Classes and Objects

PeopleSoft delivers classes of objects that you can manipulate with PeopleCode. In addition, you can extend the existing classes or create your own. The delivered classes may or may not have a graphic user interface equivalent; some are representations of data structures that occur only at runtime. With PeopleCode, you can manipulate data in the data buffer easily and consistently. These classes enable you to write code that’s more readable, more easily maintained, and more useful.

This section discusses:

  • Classes.

  • Objects.

  • Object instantiation.

A class is the formal definition of an object and acts as a template from which an instance of an object is created at runtime. The class defines the properties of the object and the methods used to control the object’s behavior.

PeopleSoft delivers predefined classes, such as Array, File, Field, SQL, and so on. You can create your own classes using the Application class. You can also extend the functionality of the existing classes using the Application class.

An object represents a unique instance of a data structure defined by the template provided by its class. Each object has its own values for the variables belonging to its class and responds to methods defined by that class. This is the same for classes provided by PeopleSoft and for classes you create yourself.

After an object has been created (instantiated) from a class, you can change its properties. A property is an attribute of an object. Properties define:

  • Object characteristics, such as name or value.

  • The state of an object, such as deleted or changed.

Some properties are read-only and cannot be set, such as Name or Author. Other properties can be set, such as Value or Label.

Objects are different from other data structures. They include code (in the form of methods), not just static data. A method is a procedure or routine, associated with one or more classes, that acts on an object.

An analogy to illustrate the difference between an object and its class is the difference between a car and the blue Citroen with license plate number TS5800B. A class is a general category, while the object is a specific instance of that class. Each car comes with standard characteristics, such as four wheels, an engine, or brakes, that define the class and are the template from which the individual car is created. You can change the properties of an individual car by personalizing it with bumper stickers or racing stripes, which is like changing the Name or Visible property of an object. The model and date that the car is created are similar to read-only properties because you cannot alter them. A tune-up acts on the individual car and changes its behavior, much as a method acts on an object.

A class is the blueprint for something, like a bicycle, a car, or a data structure. An object is the actual thing that is built using that class (or blueprint.) From the blueprint for a bicycle, you can build a specific mountain bike with 23 gears and tight suspension. From the blueprint of a data structure class, you build a specific instance of that class. Instantiation is the term for building that copy, or an instance, of a class.