Kanga Articles

Welcome Guest

Search:

Web Design, SEO & Internet Marketing - Kanga Articles » Technology » Object Oriented Programming Concepts

Object Oriented Programming Concepts

View PDF | Print View
by: Guest
Total views: 22
Word Count: 418

When you approach a programming problem in an object-oriented language, you no longer ask how the problem will be divided into functions, but how it will be divided into objects. Thinking in terms of objects, rather than functions, has a surprisingly helpful effect on how easily programs can be designed. This results from the close match between objects in the programming sense and objects in the real world.



sex toys | condoms | couples vibe

Objects
When you approach a programming problem in an object-oriented language, you no longer ask how the problem will be divided into functions, but how it will be divided into objects. Thinking in terms of objects, rather than functions, has a surprisingly helpful effect on how easily programs can be designed. This results from the close match between objects in the programming sense and objects in the real world.

What kinds of things become objects in object-oriented programs? The answer to this is limited only by your imagination, but here are some typical categories to start you thinking:

*Physical objects
Automobiles in a traffic-flow simulation
Electrical components in a circuit-design program
Countries in an economics model
Aircraft in an air traffic control system

*Elements of the computer-user environment
Windows
Menus
Graphics objects (lines, rectangles, circles)
The mouse, keyboard, disk drives, printer

*Data-storage constructs
Customized arrays
Stacks
Linked lists
Binary trees

*Human entities
Employees
Students
Customers
Salespeople

* Collections of data
An inventory
A personnel file
A dictionary
A table of the latitudes and longitudes of world cities

* User-defined data types
Time
Angles
Complex numbers
Points on the plane

* Components in computer games
Cars in an auto race
Positions in a board game (chess, checkers)
Animals in an ecological simulation
Opponents and friends in adventure games

The match between programming objects and real-world objects is the happy result of combining data and functions: The resulting objects offer a revolution in program design. No such close match between programming constructs and the items being modeled exists in a procedural language.

Classes
In OOP we say that objects are members of classes. What does this mean? Let's look at an analogy. Almost all computer languages have built-in data types. For instance, a data type int, meaning integer, is predefined in C++
You can declare as many variables of type int as you need in your program:

int day;
int count;
int divisor;
int answer;

In a similar way, you can define many objects of the same class. Class serves as a plan, or blueprint. It specifies what data and what functions will be included in objects of that class. Defining the class doesn't create any objects, just as the mere existence of data type int doesn't create any variables. A class is thus a description of a number of similar objects.

About the Author


Rating: Not yet rated

Comments

No comments posted.

Add Comment

You do not have permission to comment. If you log in, you may be able to comment.