Global Positioning System Reference
In-Depth Information
In this context, we can describe the initial intention of Java|to provide
the programming environment for a multimedia application and abstract
each component to its core functionality (see Figure 1.2). A programmer
of a multimedia center would then be able to replace any component with
another one, and hook it up to the application via a standard interface|
without modifying the controlling application. He can program a higher-
level video application. We consider this application as higher level, since
it combines steps that would normally require input on every single remote
control of the various components.
The entire application can be seen as a highly flexible remote control and
can be implemented on some hand-held device (with the ability to host a
Java Virtual Machine (JVM)). Java makes it possible to code the logic of
any application in a neutral (or standardized) programming environment.
In this section, we walk through a video application using object-oriented
terminology with devices being special types of objects or components. The
purpose of the video application is to provide a consumer friendly front end
with high usability. This example gives an introduction to programming
with objects.
For the initial analysis, the following sample use case will be used: the
user would like to record tonight's ball game, without knowing the kicko
time, and watch the news at eight.
Application programming interface. By defining the API for the function-
ality (or services) of each component, the complete functionality is defined.
At this point the individual APIs are not listed; they will become apparent
in the program flow.
Application program flow. The program flow is the environment where ob-
jects are referenced, controlled, and combined in a logical context. In order
to execute commands (methods) on a device, it has to be powered up and
initialized. In the context of object-oriented programming, we construct
objects with the new operator and the constructor of a class. In a way, the
power button represents the constructor of a device!
The beginning of an object-oriented video application could look like
this:
tvGuide = new EPG( myZipCode )
tv = new TelevisionSet( modelXY )
vcr = new VideoRecorder( modelYZ )
These three lines of code have many implications to distributed operations:
Each line might wake up a device, do a system check, or start up the
subcomponents. These operations can take time, and the constructor of
each component should be designed in a way that it returns some error
code, if something goes wrong, e.g., if an exception occurs. Nevertheless,
 
Search WWH ::




Custom Search