Ts5011 � Managing people and Technology by HC121001044621


									                       Ts5011 – Managing people and Technology
                                   Mark Lindquist
                                Unit 10 Assignment 1

April 20th, 2009
Object Oriented Programming:

Our NewwDeal Hand-Held Device Initiative (HHDI) made up of the hand-held devices
that comprise our new check-in and check-out system will be run by software. The
software used to make up HHDI is written with a programming language which when
written out has a syntax which is called code. This code is the heart of the software as it
contains instructions on how the software program features will be executed. To
understand how HHDI will be constructed we need to understand a little about
programming languages. The language we will be using for HHDI is an Object Oriented
Programming Language (OOPL) called Java.

Today software undoubtedly runs our lives. Everything from, using the remote control to
our TV’s to attending class in distance learning programs, software leads us in our daily
activities. With the advent of computers in the later half of the 1900’s software has
increasingly become more complex and efficient in running the normal patterns of our
daily lives. But how is software that runs our lives created? How does it exist within
cyberspace? What is the history of computer languages? To answer these question we
start at the beginning.

Some believe that the first computer program was written by Ada Lovelace way back in
1842-43. The program ran on nothing more than an analytical engine for producing
calculations. The contribution however to today’s modern programming languages was
essentially not there and it wasn’t until the 1950s when the computer was in its infancy
that structured computer languages were developed which are still in use today.

Structured programming languages were first on the scene as a modern day programming
language. Structured languages were the sign of the times. The programs that these
languages executed were not dynamic however. Interactivity was non-existent as each
line of code was executed one after another (No branching existed.). Routine
mathematical calculations were the extent of its ability.

Problems with these structured languages quickly developed as programmers realized
that limitations existed when each line of code had to be executed from line one down to
the last line in sequential order. This was indicative of the infancy of computer software.
The code that runs in a sequential manner does not take into account the increasingly
interactive nature and complexity of today’s computer software. How, for instance,
would you tell a program to take one course of action over another depending on user
At first the answer came in the form of procedural languages. A procedural language
works by executing a set of commands at the start of a program one after another until a
branch in the code is encountered. A branch statement or “If” statement in code talk,
executes a command or set of commands according to some user input.

If sally brings up a website and fills out a form and then clicks the submit button, then her
user input to the form determines what the code will do or what procedure the code will
execute. If she enters California as her residence and hits submit she could be presented
with a screen about California. Likewise if she enters Massachusetts as her residence she
may be taken to a Massachusetts friendly website. The “if” statement allows code to
branch in this way according to user input.

Procedural languages then are able to interact with the user as structured languages could
not. The “If” statement, a follower of the original GOTO statement in structured
languages, provides the mechanism to branch according to user inputs. So we have gone
from computer programs that performed calculations in a structured, sequential order to
programs that run procedurally, accepting user inputs and executing code accordingly.
But with the ever increasing sophistication of software programs a new paradigm needed
to be developed. That new paradigm became known as Object Oriented Programming

Origins of OOP here.

OOP is a relatively new kind of programming language that allows one to create real life
objects within software programs that have state and behavior. The state of an object is its
physical properties i.e. color, size, weight, etc. while behavior is how an object reacts to
user actions or “events” that change some part of these inner states of an object. For
instance, in the real world a car is an object. A car has state, color, size, weight, speed,
etc. A car also has behaviors; move forward, move backward, stop, turn, etc. Now when a
user steps on the gas pedal, a behavior of the car object and a user input, to make it go
faster, it will change the inner state of speed as requested, an interactive type of

In software an object behaves the same way. A button on some program’s user interface
is an object with state and behavior. The state of the button object could be color, size,
position etc. while the behavior of a button would be down and up. A form to be filled
out has text field objects and is an object itself in the form of a form object. New and
independent objects are also created; objects that offer some real and unique feature that
the customer wants. Within HHDI an object could be created that has the behavior of
choosing the state (menu) according to a customer’s input. But what actually happens
within the OOP paradigm that makes it so powerful?

OOP works by first creating a “Class.” A Class is a blueprint of an object. Within OOP
you first create this blueprint, a Class, which consists of state or variables that define
color, size, etc. of the object and the behavior or method of the object that changes in
some way these variables while performing some function.
After your class is created, containing the inner state in the form of variables, and the
behaviors that will define the HHDI software features are created your object is ready to
be used within the program. So far we have seen that objects are powerful and that they
run our HHDI by changing inner properties or state and executing methods or behaviors
that satisfy requirements that make up a functioning system. But how does the object
change the state and perform some function?

As a Class or blueprint the object does not yet exist and it knows no instructions on what
to do. All we have done is created a Class file or blueprint that represents our real life
object. The blueprint contains all the states and behaviors that will make up the real life
object; the Class is of little use unless you instantiate the Class into an object. By
instantiating the object you are telling within code that a new object exists with a
blueprint on how the object will behave.

To top