Previous Page | Next Page

SAS Object-Oriented Programming Concepts

Introduction to Object-Oriented Programming

Object-oriented programming (OOP) is a technique for writing computer software. The term object oriented refers to the methodology of developing software in which the emphasis is on the data, while the procedure or program flow is de-emphasized. That is, when designing an OOP program, you do not concentrate on the order of the steps that the program performs. Instead, you concentrate on the data in the program and on the operations that you perform on that data.

Advocates of object-oriented programming claim that applications that are developed using an object-oriented approach

Object-oriented application design determines which operations are performed on which data, and then groups the related data and operations into categories. When the design is implemented, these categories are called classes. A class defines the data and the operations that you can perform on the data. In SCL, the data for a class is defined through the class's attributes, events, event handlers, and interfaces. (Legacy classes store data in instance variables.) The operations that you perform on the data are called methods.

Objects are data elements in your application that perform some function for you. Objects can be visual objects that you place on the frame--for example, icons, push buttons, or radio boxes. Visual objects are called controls; they display information or accept user input.

Objects can also be nonvisual objects that manage the application behind the scenes; for example, an object that enables you to interact with SAS data sets may not have a visual representation but still provides you with the functionality to perform actions on a SAS data set such as accessing variables, adding data, or deleting data. An object or component is derived from, or is an instance of, a class. The terms object, component, and instance are interchangeable.

Software objects are self-contained entities that possess three basic characteristics:

behavior

a collection of operations that an object can perform on itself or on other objects. Methods define the operations that an object can perform. For example, you can use the _onGeneric method in sashelp.classes.programHalt.class to trap all generic errors.

state

a collection of attributes and their current values. Two of the programHalt component's attributes are stopExecution (which determines whether the program continues to execute after the program halt occurs) and dump (which contains the program-halt information). You can set these values through SCL.

identity

a unique value that distinguishes one object from another. This identifier is referred to as its object identifier. The object identifier is created by SCL when you instantiate an object with the _NEW_ operator. This identifier is also used as the first-level qualifier in SCL dot notation.

This chapter describes how object-oriented techniques and related concepts are implemented in SCL.

Previous Page | Next Page | Top of Page