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
-
are easier to understand because
the underlying code maps directly to real-world concepts that they
seek to model
-
are easier to modify and maintain
because changes tend to involve individual objects and not the entire
system
-
promote software reuse because
of modular design and low interdependence among modules
-
offer improved quality because
they are constructed from stable intermediate classes
-
provide better scalability for
creating large, complex systems
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
SAS/AF software, 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 in
SAS/AF software.
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:
a collection of attributes
and their current values. Two of a Push Button control's attributes
are label
(the text displayed on the
command push button) and commandOnClick
(the command that executes when the command push button is pressed).
You can set these values through the Properties window or through SCL.
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, a Push
Button can set its own border style via the _setBorderStyle method.
a unique value that
distinguishes one object from another. In SAS/AF, this identifier is referred to as its object identifier.
The object 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 SAS Component Language (SCL) and in
SAS/AF software.