Guide to Object-Oriented Programming Principles

Object-Oriented Programming (OOP) has been around for many years, but basically centres on the concept of an Object being the instance of a Class, which have Properties that essentially describe the parts of the Object, and Methods that perform some sort of function or procedure, which can have its own parameters, use the properties of other objects, or data held in variables.

OOP has come a long way from the Massachusetts Institute of Technology (MIT) back in the 1960ís and its implementation by Xerox to send messages between objects. My earliest use of OOP was back in the early 1990ís with Pascal, which evolved into Delphi, COBOL, which was more of a programming language associated with Main-frame machines, and Visual Basic, which is now part of the .NET Framework. Other languages around at the time were C++, and FoxPro, which was more text based for MS-DOS systems, and more recently, Java has emerged, and is now one of the most widely used language, mainly because of its cross-compatibility.

Before I get bogged down, letís look at the concept of OOP, and the best way of explaining this is by correlating it to something in the real world, and I think the easiest to understand is by taking a Motor Car analogy. If you look at a Car, without getting too technical, it has an engine, seats, a steering wheel, brakes, accelerator, gearbox, etc. In an Object-Oriented Programming sense, you could say that each of these is an Object, with the Car itself as the parent Object, and the others interacting with it.

Thinking of it in simple terms, a Car object could have properties such as its colour, number of doors, make, model etc. It could also have methods such as Unlock the Door, which would have a parameter to indicate which door, or maybe the boot or bonnet. The Engine object could have properties describing its size, type, capacity etc. and methods to Start and Stop, this could also interact with other objects like one to control fuel.

When you think of things in this way, it is easier to understand the way in which an Application could manage and use its objects. Going to a more practical programming example, one of the most common types of object used is one that manages an Image, or collection of Images. In my early days I wrote an application based on the old Windows Imaging Object, which could open, display, convert, zoom, and manipulate an Image.

Amongst other things it had properties for the filename, image type, zoom level, and in some cases page number. It then had methods to Display, Refresh, Rotate, and Save the image to a new file, some with extra parameters, i.e. Save As method would have a parameter for the new filename, Rotate would have a parameter to indicate which direction and the degree of rotation.

Objects can also inherit properties and methods from Parent objects, which make it possible to re-use and share functionality across different applications, and makes it relatively simple to write applications. Programming languages also come with a variety of functions which can be called from any method or procedure. Some say that VB.NET is more of a Procedural language than an OOP; I disagree, as procedures are written to call and use objects.

To better describe the way in which Excel, Access, and VB.NET use and work with Objects, there are further articles in those sections of this website.