Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Text B. OBJECT-ORIENTED PROGRAMMING

 

One of the principal motivations for using OOP is to handle multimedia applications in which such diverse data types as sound and video can be packaged together into executable modules. Another is writing program code that's more intuitive and reusable; in other words, code that shortens program-development time.

Perhaps the key feature of OOP is encapsulation - bundling data and program instructions into modules called 'objects', Here's an example of how objects work. An icon on a display screen might be called 'Triangles'. When the user selects the Triangles icon which is an object composed of the properties of triangles and other data and instructions - a menu might appear on the screen offering several choices. The choices may be (1) create a new triangle and (2) fetch a triangle already in storage. The menu, too, is an object, as are the choices on it. Each time a user selects an object, instructions inside the object are executed with whatever properties or data the object holds, to get to the next step. For instance, when the user wants to create a triangle, the application might execute a set of instructions that displays several types of triangles - right, equilateral, isosceles, and so on.

Many industry observers feel that the encapsulation feature of 00P is the natural tool for complex applications in which speech and moving images are integrated with text and graphics. With moving images and voice built into the objects themselves, program developers avoid the sticky problem of deciding how each separate type of data is to be integrated and 3-5 synchronized into a working whole.

A second key feature of OOP is inheritance. This allows OOP developers to define one class of objects, say 'Rectangles', and a specific instance of this class, say 'Squares' (a rectangle with equal sides). Thus, all properties of rectangles - 'Has 4 sides' and 'Contains 4 right angles' are the two shown here - are automatically inherited by Squares.

A third principle behind OOP is polymorphism. This means that different objects can receive the same instructions but deal with them in different ways. For instance, consider again the triangles example. If the user right clicks the mouse on 'Right triangle', a voice clip might explain the properties of right triangles. However, if the mouse is right clicked on 'Equilateral triangle' the voice instead explains properties of equilateral triangles.

The combination of encapsulation, inheritance and polymorphism leads to code reusability. 'Reusable code' means that new programs can easily be copied and pasted together from old programs. All one has to do is access a library of objects and stitch them into a working whole. This eliminates the need to write code from scratch and then debug it. Code reusability makes both program development and program maintenance faster.

 

Task 11. Write a paragraph describing the strategies of converting to a new computer system. Explain what its advantages and disadvantages are.

 

Unit 8

 

Pre-reading activity

 


Date: 2015-01-02; view: 892


<== previous page | next page ==>
Task 4. Match the terms with their definitions. | Procedural Languages
doclecture.net - lectures - 2014-2020 year. Copyright infringement or personal data (0.002 sec.)