In today's society computers and computer information systems are implemented everywhere and are used to perform a diverse variety of functions and tasks. The applications that computers can be put to use in are numerous and limited only by the imagination. At the most basic level a computer is simply a device which accepts information, processes it in a well defined, deterministic fashion then spits the resulting information back out. The general concept of a computer and what it does is very simple. However, the conceptual simplicity of the computer makes it extremely versatile and flexible as to what it can be implemented as and used for. This means that a computer can be any device which accepts, processes and outputs information and in doing so accomplishes some useful task. Computers come in all sizes, shapes and forms. Besides being implemented as the familiar desktop computer, a computer can be a server, mainframe, laptop device, palmtop device, embedded system, micro controller, watch, cellular phone, calculator, etc... But, no matter what form a computer takes they all share one thing in common. The usefullness and reliability of a computer is dependent on the quality of the software that is written for it to run. All computers need software for them to perform their intended task and all good quality software needs to be designed, written and maintained by competent and skilled computer programmers.
The purpose of this section is to present a tutorial in computer science and and modern programming techniques. Some of you who are viewing this section may find some of this information obvious, especially if you are a veteran programmer or analyst. Please keep in mind that some people may not find this stuff obvious, especially for those with no previous programming experience. However, if you are bored and wish to skip ahead to the demo section click here.
Lets start off with a very brief overview of computer science and the art of
Computer Science is the study of algorithms and the machines that implement them. Every program ever written first starts off as an algorithm. The algorithm expresses a sequence of procedures that is used to solve a well defined problem. Once an algorithm is established it is implemented in a programming language usually this would be a high level language which shares many similarities in terms of syntax and semantics to the way an algorithm is expressed. Algorithms are basically ideas and these are usually written out in plain simple language like English. Algorithms expressed in this form is commonly called pseudo code. This is important because the most critical and difficult part of a program is not the computer language code, but the plan or idea that is used for carrying out the task. Once you come up with the plan or idea it can be implemented it any language you wish to use (of course choosing the language that has the features necessary to do the job always helps). Coding the program is always the easy part. An effective algorithm will make the difference in both the reliability and efficiency of a program.
What kind of task can a computer solve? The task must be well defined.
This implies the following 4 properties:
How is a complex algorithm built from simple actions?
// The following code is the select sort algorithm
// implemented in the C programming language
for (outer = 0; outer < limit - 1; ++outer)
for (inner = outer + 1; inner < limit; ++inner)
if (array[inner] < array[outer])
The next section will go over some modern techniques in programming and program design.
The old style of dealing with different types of data was just to pass them off to sub-procedures and have them check whether or not they were passed valid data to work on. The sub-procedures would accept arguments that are passed to it from the main program or from other sub-procedures. However, this places the responsibility on the programmer to match every piece of data correctly with every procedure that is used in the program. This style of programming is called procedural or structural programming. In this style the procedures or operations to be performed on data is separate from the data itself. The idea is that in a program, data is passed to a procedure or a series of procedures which operates on the piece of data in order to manipulate it. Some people thought that separating the data from the procedures that is applied on them and having to explicitly "pass" each piece of data to the corresponding procedure in order to manipulate the data was too much mucking around and too messy.
This brings us to the concept of an Abstract Data Type or ADT for short. The
ADT demonstrates the technique of abstraction for simplifying the data
elements and their relationships within a program. The ADT builds a conceptual
model for a particular type of data by grouping the data elements that composes
the data type with the specific operations which are required and valid for it.
Instead of having data operations and data elements separated within a program and
matched data-to-procedure. the ADT model requires that each piece of data and
their corresponding operations be grouped together. Also with an ADT the
specification of the ADT is separate from the declarations which implements
it. This is because an ADT is an abstract model of the data type. With
an ADT you can specify what operations a particular type of data should support
while leaving the actual the implementation of the data type independent from the
its specifications. Why would you want to do that? Well, because its one of the
most powerful techniques available to the software engineer when designing a
program. This is because during the construction of the program once you have
the behaviour of each of the data types specified, performing an operation
on a piece of data is simply a matter of calling the appropriate member
function that is part of the ADT. Since the details of the implementation
for the particular data type is hidden within the ADT class this is one
less component of the program the programmer needs to worry about. Another
advantage of this is since, the implementation for accessing and manipulating the
data is hidden with the only interface "outside" of the ADT done through
member functions (also called methods), the ADT becomes a
This self-contained property of an ADT offers a number of important advantages:
A simple example of abstraction would be an alarm clock. The alarm clock has a display showing the time. And some buttons for setting the current time and the activation time for the alarm. Of course there is more to the alarm clock than this. If the alarm clock is one of the popular electronic versions that are used today then there is also the digital circuitry that is needed to control the alarm clock. The digital circuitry itself must be put together in a certain way that allows it to function as an alarm device. But, as a user of the alarm clock you don't think about nor do you need to think about these internal details. This is because the alarm clock acts as an ADT. The user interface which would be the buttons on the alarm clock is analogous to the member functions for the ADT. The internal circuitry of the alarm clock is analogous to the programming logic and algorithms implemented within the member functions of the ADT. Similar to the ADT in which all "outside" interactions to the ADT is done through its user interface by calling its member functions, all interactions on the alarm clock is done through its user interface by pressing the buttons on it. Abstraction create black boxes by hiding the internal low level details to create a higher level of interaction between the user and the device. The device itself could either be a virtual device as in a piece of program logic or a physical device as in an alarm clock it doesn't matter the concept is the same.
Here's a diagram which illustrates how abstraction works in C++. The thick line of the inner circle containing the data members of the class, indicates that they are not visible to the main client program, but only visible to the member functions of the class. Function A, Function B, Destructor and Constructor are all member functions of this particular class. The only way the client program can manipulate the data of the class is to call these member functions (black arrows). The member functions in turn sets up the two-way communication (red arrows) between the actual data of the class and the client program through a piece of programming code design specifically for the task the member function is to accomplish. All the messy, uninteresting, low-level details are hidden within the code of the member functions. All that the client needs to know is which member function to call for accomplishing a particular task.
Because abstraction can be applied to both physical and virtual devices and since an ADT is a conceptual model developed through abstraction, this leads us to another important feature of the ADT. An ADT can be used to model physical devices and systems. By doing this, physical devices and virtual devices can become interchangeable (at least within a computer program). Physical devices can model virtual devices and vice versa. This is the basic idea behind virtual machines. This includes the popular Java Virtual Machine which executes the bytecodes of a Java program in different hardware and system environments provided that the virtual machine is implemented on its native platform.
Abstract Data Types (ADTs) are implemented in C++ through the class language feature.
E-mail: email@example.com firstname.lastname@example.org