Introduction to Object-Oriented Programming

The first step to understanding the LotusScript language is to review OOP terminology. Object-oriented programming sounds complex. However, it's really just another way to organize and develop software code. This organization revolves around objects, classes, properties, and methods.

Objects are considered to be the basic building blocks of a software application. Objects have specific attributes and a distinct set of related capabilities. Let's take, for example, an airplane. It's composed of many parts such as engines, tires, navigational instruments, windows, seats, passenger radio, and so on. Each part, or object, has a distinct set of attributes such as color, size, shape, movement, and so on (see Figure 6.1).

Figure 6.1. A plane contains many parts that have specific attributes and functions. Similarly, a class is comprised of many objects that have specific properties and methods.

Attributes, also known as properties, describe an object. All objects have a unique set of attributes that describe characteristics of that object. For instance, the properties of the "tire" object may include brand name, size, recommended PSI, and performance rating, whereas the properties for the "engine" will be entirely different and may include thrust, weight, size, or similar properties.

Methods, on the other hand, are used to manipulate the object attributes. Like properties, each object has a finite set of commands, or methods, that are used to modify the object. For example, the pilot could set the landing gear to be up or down. This could equate to two separate methodsone to raise the landing gear and another to lower the landing gear.

The combination of these objects (or in this case, airplane parts) comprises a class (in this case, a working plane), where each object has a unique set of properties and methods.

Категории