Learning to Speak OOP
For you to start getting serious about object-oriented programming, you first need to learn some basic terms and concepts. This article covers the common vocabulary used in OOP and how it's implemented in Visual Basic .NET.
Learning the OOP vocabulary and concepts gives you a foundation to build on when you're learning how to do object-oriented development (OOD). A subtle difference between OOP and OOD escapes many junior software developers. However, that difference separates a person who can write an object-oriented application and one who can design an object-oriented application.
In this article, you will learn what different terms mean and how they apply to building object-oriented applications. By the end of the article, you should have an understanding of the following terms:
- Objects and classes
- Members and properties
- Methods and events
- Constructors and destructors
- Interfaces
Objects
To develop an object-oriented application, you must first understand what an object is and how to put it with other objects to build something complex such as a complete application. In simple terms, an object is any item that you can individually select and manipulate. In programming terms, an object is a self-contained entity that contains both data and code in the form of subroutines and functions to manipulate and access the data.
Complex software applications are built by using multiple object types, each with its own specialty and identity. An object-oriented view of a company would have employees, buildings, departments, locations, and so on as objects. An object-oriented view of a software package would have buttons, edit controls, windows, data, and so on as objects.
Objects have what's known as state. The state of an object is the internal information that describes the object. For example, the state of a check box object indicates whether the check box is checked or unchecked. More complex objects could have a wide range of state information.
State information is internal to an object; however, it generally doesn't change without an outside agent acting on it, such as another object. However, some objects change their own state and are referred to as actors, active objects, or objects with life. A timer object is an example of an object that changes its own state as it keeps track of elapsed time.