Object Oriented Programming

Published on June 2017 | Categories: Documents | Downloads: 36 | Comments: 0 | Views: 352
of 2
Download PDF   Embed   Report

Comments

Content

Yourlastname 1

Student Name Professor Name Subject 8 May 2000 Object-Oriented Programming The main advantage of procedural programming is its simplicity. Having a linear structure it executes instructions exactly in the order in which they appear in the program code. However, such approach works well only in the small programs. For larger projects procedural code may become messy and problems may arise when it is required to modify some functions of the program. Therefore, object-oriented programming approach was developed, which has two important features – encapsulation and inheritance. Encapsulation means that each logical entity in the program is designed as a separate piece of code which includes variables that describe this entity (they are called properties) and functions that can perform operations over the entity (methods). Such piece of code is called a class and every actual realization (or instance) of the class in the main body of the program is called an object. Encapsulation makes it possible to develop different parts of the program in parallel and test them separately. Even more important, changes in the main body of the program do not affect the description of the class, which greatly simplifies debugging. Inheritance in OOP means that programmer can create new classes which will inherit all properties and methods from other classes and extend them to include new functions and properties. Such approach significantly optimizes code development process. To understand the benefits of OOP better consider the application that allows user to create geometric figures on a Cartesian plane and find their lengths and areas. It would be natural to start with the class which describes the point on a plane and then extend it by inheritance procedure to the classes of the line and line segment. For the latter the method which calculates length may be developed. Further on classes for triangles, rectangles and other figures may be introduced, each having its own method for area calculation.

Yourlastname 2

Works Cited Farrell, Joyce. An Object-Oriented Approach to Programming Logic and Design. Cengage Learning, 2012. Print.

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close