Both object-oriented programming and Java are important to every level of programmer as shown by the release of Eurotech Inc's Helios platform (see Reuters: Eurotech Launches Helios(TM) Platform, Industry's First Programmable Edge Controller).
The company's president and CTO, Arlen Nipper, said "Combining our configurable hardware platform, Helios, with the ESF middleware gives Eurotech customers the greatest range of flexibility, in I/O options, connectivity choices, and object-oriented programming".
The middleware framework itself is Java based. This, of course, raises an important question for any new programmers. How do they start object-oriented design, and how do turn an object-oriented design into a Java application? It is, therefore, worth considering the basics of object-oriented programming.
A Universe Full of Objects
An object is simply something that exists in the universe. Take, for instance, the Kawasaki Ninja ZX-10R. The Kawasaki Ninja ZX-10R:
- has an 899cc, four stroke engine with a DOHC (Double Over Head Cam)
- has a 3.7 imperial gallon or 4.5 US gallon fuel tank
- accelerates from 0 to 60 mph in 2.9 seconds
- has two wheels.
And it's green.
The Abstraction of a Class from an Object
Having examined an existing object a programmer can create a blueprint of that object. This blueprint, better known as a class, contains all of the elements that defines an idealized object. In this case it's a motorcycle class:
This process of extracting the key information about a class is know as abstraction, and here the color of the motorcycle is not important, but the fact that it has a color is. However, the number of wheels is important and so that is defined as a constant.
Creating One Class from Another Class
One very useful aspect of classes is the ability of a programmer to create a new class from an existing one. For example, the programmer can create a new type of motorcycle using the motorcycle class as a base. This new child class will have all of the same attributes as the parent class:
The child class is said to have inherited the characteristics of the parent class.
Instantiating an Object
At the moment the class are idealized objects. They are, for example, the bike in the bike catalog. They are not the real bike sat on someone's driveway. The next stage, therefore, to create the real object and use it in an application:
And so at the end of this process:
- a general class has been abstracted from a real world object
- child classes can inherit the characteristics of parent classes
- classes are instantiated into objects to be used in an application
The programmer (Java or otherwise) can the goon in this way until they have represented everything that they need in their cyber-universe.