Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write and explain the definition of what composition is and how it is useful in

ID: 3661148 • Letter: W

Question

Write and explain the definition of what composition is and how it is useful in writing an object-oriented program. Also, explain how it is different from inheritance and how both inheritance and composition are useful in developing object-oriented programs.(Points : 10)

Explanation / Answer

Computer programming that emphasizes the structure of data and their encapsulation with the procedures that operate upon it. It is a departure from traditional or procedural programming. OOP languages incorporate objects that are self-contained collections of computational procedures and data structures. Programs can be written by assembling sets of these predefined objects in far less time than is possible using conventional procedural languages. OOP has become extremely popular because of its high programming productivity. C++ and Objective-C (early 1980s) are object-oriented versions of C that have gained much popularity. Java. For more information on object-oriented programming, visit Britannica.com. McGraw-Hill Science & Technology Encyclopedia: Object-oriented programming Top Home > Library > Science > Sci-Tech Encyclopedia A computer-programming methodology that focuses on data items rather than processes. Traditional software development models assume a top-down approach. A functional description of a system is produced and then refined until a running implementation is achieved. Data structures (and file structures) are proposed and evaluated based on how well they support the functional models. The object-oriented approach focuses first on the data items (entities, objects) that are being manipulated. The emphasis is on characterizing the data items as active entities which can perform operations on and for themselves. It then describes how system behavior is implemented through the interaction of the data items. The essence of the object-oriented approach is the use of abstract data types, polymorphism, and reuse through inheritance. Abstract data types define the active data items described above. A traditional data type in a programming language describes only the structure of a data item. An abstract data type also describes operations that may be requested of the data item. It is the ability to associate operations with data items that makes them active. The abstract data type makes operations available without revealing the details of how the operations are implemented, preventing programmers from becoming dependent on implementation details. The definition of an operation is considered a contract between the implementor of the abstract data type and the user of the abstract data type. The implementor is free to perform the operation in any appropriate manner as long as the operation fulfills its contract. Object-oriented programming languages give abstract data types the name class. Polymorphism in the object-oriented approach refers to the ability of a programmer to treat many different types of objects in a uniform manner by invoking the same operation on each object. Because the objects are instances of abstract data types, they may implement the operation differently as long as they fulfill the agreement in their common contract. A new abstract data type (class) can be created in object-oriented programming simply by stating how the new type differs from some existing type. A feature that is not described as different will be shared by the two types, constituting reuse through inheritance. Inheritance is useful because it replaces the practice of copying an entire abstract data type in order to change a single feature. In the object-oriented approach, a class is used to define an abstract data type, and the operations of the type are referred to as methods. An instance of a class is termed an object instance or simply an object. To invoke an operation on an object instance, the programmer sends a message to the object.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote