Вы находитесь на странице: 1из 6

Central Bank of Barbados SECONDARY SCHOOLS OUTREACH PROGRAMME Information Technology Fair

Information Technology and Education Investing in our Future

November 8 - 10, 2004

The Move to Object Oriented Programming

An overview compiled by Management Information Systems Department

Definition
The concept of object-oriented programming (OOP) was conceived in order to enable computer programs to model real world ideas. Programs are organized as a collection of self-sufficient entities called objects. Each object has certain attributes or characteristics and behaviours. Objects can also communicate with each other via requests called messages. Depending on the nature of the message, the state of the attribute or the behaviour of the object can change.

Terms and concepts


From the above definition it can be seen that there are several terms and concepts that are associated with OOP. These are:

Object
This is a representation of some real world thing or event. A car, person or bank account is an example of an object. Each of these objects has certain characteristics and behaviours. For example, a person has eyes, skin and a name and can walk and talk.

Attribute Attribute
This is a feature or characteristic, which defines the object. For example, some of the attributes of a car are its windows, doors and engine. An attribute will define the state when we describe it. The window may be opened, the door unlocked or the engine running.

Method
A method or behaviour can be thought of as something that the object can do and is used to control the attributes of an object. For example, a person can walk. The method of walking determines how the feet attribute of the object behaves.

ObjectMoving to Object-Oriented Programming - 1

Class
A class is a set of similar objects that share the same attributes and methods. It can be thought of as the generic template or blueprint for an object. For example, cars, trucks and buses are all similar objects, which we collectively describe as vehicles.

Message
This is a request from one object to another object to perform one of its methods. To illustrate, if a man wishes to get into a car he must first open the car door. To do so within the program, the object man must make a request to the object car to perform its open door method.

Event
This is an occurrence, which may cause the state of a system to change. An event occurs when the user of the application takes some action, when the value of an attribute changes or a certain condition is met. For example, if the driver of a moving car wishes to stop it, the event of the person driving the car pressing the brakes must occur. Methods that are designed to respond to an event are called event handlers.

Encapsulation Encapsulation
Also known as information hiding, this is the process of packaging several items together into one unit. For example, eyes, hair, skin, walking, talking are all grouped together as the object person.

Inheritance
This is the process by which a class can be created from another class. This process produces a parent-child relationship where the child class can reuse the attributes and methods of the parent class. The child class may also have unique attributes and methods of its own. For example, a student class can be created from the person class. Both classes have the same attributes and can perform the same methods. ObjectMoving to Object-Oriented Programming - 2

However, students can have additional attributes such as a student number and can perform other methods such as taking tests.

Polymorphism
This is the process by which a class can behave differently when presented with varying information. For example, if we have a rock thrown at a window, depending on if the window is open, the rock may enter the building or if the window is closed, the rock may break the glass.

Benefits
There are several benefits to OOP. These include:

Reusabilty
Classes are designed so that they can be reused in many systems.

More efficient application development


Programs are built in smaller more manageable components which can come from several vendors and can be seen, customized and interlinked using CASE (Computer Aided System Engineering) tools in a seamless fashion.

Maintainabilty
Software built from proven stable classes is likely to have less bugs than software built from scratch. However, if a bug is found it is more likely to be localized to one class therefore easier to find and correct.

Dynamic lifecycle
Object oriented techniques and tools allow for changes to more easily be incorporated throughout the development process. Thus, creating a better and more refined end result. ObjectMoving to Object-Oriented Programming - 3

More realistic modeling


Object oriented analysis models the domain more closely than traditional techniques.

Better communication between developers and users


Users typically understand the object oriented techniques more easily.

Object oriented programming languages


Somes object-oriented programming languages are: ! Java
http://java.sun.com/developer/onlineTraining/

! C++

http://www.cplusplus.com/doc/tutorial/

! Simula

http://www.engin.umd.umich.edu/CIS/course.des/cis400/simula/simula.html

! Modula-3
http://www1.cs.columbia.edu/graphics/modula3/tutorial/www/m3_toc.html

! Eiffel
http://www.engin.umd.umich.edu/CIS/course.des/cis400/eiffel/eiffel.html

! Smalltalk
http://www.engin.umd.umich.edu/CIS/course.des/cis400/smalltalk/smalltalk.html

! Self
http://research.sun.com/self/language.html

! Sather
http://www.icsi.berkeley.edu/~sather/Publications/article.html

ObjectMoving to Object-Oriented Programming - 4

References

Books
! ! ! ! Booch, G. (1994). Object-oriented Analysis and Design with Applications. Santa Clara, CA: Addison-Wesley. Connolly, T. and Begg, C. (1999). Database Systems: A Practical Approach to design,

Implementation, and Management 2nd edn. Santa Clara, CA: Addison-Wesley.


Kendall, K. and Kendall, J. (2001). Systems Analysis and Design 5th edn. Upper Saddle River, NJ: Prentice Hall. Whitten, J.; Bentley, L. and Dittman, K. (2001). Systems Analysis and Design Methods 5th edn. New York, NY: McGraw-Hill.

Web
! ! ! ! www.eimc.brad.ac.uk/java/tutorial/Project/1/ooprim.htm http://heim.ifi.uio.no/~kristen/FORSKNINGSDOK_MAPPE/F_OO_start.html http://www.cs.unc.edu/Courses/wwwp-s98/docs/lessons/java/o-o_concepts/ http://en.wikipedia.org/wiki/Object-oriented_programming http://www.rescomp.berkeley.edu/~hossman/cs263/paper.html

ObjectMoving to Object-Oriented Programming - 5

Вам также может понравиться