11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Oobject-oriented programming (OOP)During the last two decades the way in which programmersview the data structures <strong>and</strong> functions that make up programshas significantly changed. In simplified form the earliestapproach to programming was roughly the following:• Determine what results (or output) the user needs.• Choose or devise an algorithm (procedure) for gettingthat result.• Declare the variables needed to hold the input data.• Get the data from the file or user input.• Assign the data to the variables.• Execute the algorithm using those variables.• Output the result.While this type <strong>of</strong> approach <strong>of</strong>ten works well for small“quick <strong>and</strong> dirty” programs, it becomes problematic as thecomplexity <strong>of</strong> the program increases. In real-world applicationsdata structures (such as for a customer record orinventory file) are accessed <strong>and</strong> updated by many differentroutines, such as billing, inventory, auditing, summaryreport generation, <strong>and</strong> so on. It is easy for a programmerworking on one part <strong>of</strong> the program to make a change in adata field specification (such as changing its size or underlyingdata type) without other programmers finding out.Suddenly, other parts <strong>of</strong> the program that relied on theoriginal definitions start to “break,” giving errors, or worse,silently produce incorrect results.During the 1970s, computer scientists advocated a variety<strong>of</strong> reforms in programming practices (see structuredprogramming) in an attempt to make code both more readable<strong>and</strong> safer from unwanted side effects. For example, the“goto” or arbitrary jump from one part <strong>of</strong> the program toanother was discouraged in favor <strong>of</strong> strictly controlled iterativestructures (see loop). Also encouraged was the declaration<strong>of</strong> local variables that could not be changed fromoutside the procedure in which they were defined.Development <strong>of</strong> Object-Oriented LanguagesHowever, a more radical programming paradigm was alsoin the making. In existing languages, there is no inherentconnection between data <strong>and</strong> the procedures that operateupon that data. For example, the employee record may bedeclared somewhere near the beginning <strong>of</strong> the program,while procedures to update fields in the record, copy therecord, print the record, <strong>and</strong> so on may well be found manypages deeper into the program.A new approach, object-oriented programming is basedon the fact that in daily life we interact with thous<strong>and</strong>s<strong>of</strong> objects. An object, such as a ball, has properties (suchas size <strong>and</strong> color) <strong>and</strong> capabilities (such as bouncing). Ininteracting with an object, we use its capabilities. It is muchmore natural to think <strong>of</strong> an object as a whole than to haveits properties <strong>and</strong> capabilities jumbled together with those<strong>of</strong> other objects.Simula 67, developed in the late 1960s, was the firstobject-oriented language (see Simula). It was followed inthe 1970s by Smalltalk, a language developed at the Xerox339

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!