Wednesday, January 29, 2020

Reusability of Code Essay Example for Free

Reusability of Code Essay Reusability of codes general purpose is to reduce unnecessary coding which in the end reduces project development time and funds. It is essentially taking code from one part of a program and attempting to employ it elsewhere without having to alter too much. This method is similar to reusing software mechanisms in object-oriented programming. Object-oriented programming and procedural programming are two programming paradigms that distribute common attributes as well as various differences. A procedure is an additional name for a routing, technique or function. Procedures and objects both use algorithms to develop the system and any logical calculation that is necessary for the program. A function is divided from variables and data compositions. Procedures are intended to run the code in a precise order, while OPP merges data with the function in the function changes the data that is bound to it into a unit identified as an object. Other useful features such as abstraction, encapsulation, and inheritance can be achieved while working with OPP. Procedural Programming The earliest programming languages were procedural, meaning a program was made of one or more procedures. A procedure is simply a module or function that performs a specific task such as gathering input from the user, performing calculations, reading or writing files, displaying output, and so on. The programs that you have written so far have been procedural in nature. The steps a program must perform to reach the desired outcome. Procedure is an independent entity and a sequence of instructions that are grouped together. In procedural programming, a task is broken down into assortment of variables and subroutines. In OPP, a task is broken down into objects which summarize the data and execution. In a procedural approach, the entirely called variable is termed as a trait of the object. The idea is to encapsulate data and a technique into what is referred to as a class. A class is a model; a class can be used to make several objects. This allows code be reusable in OPP. Object-Oriented Programming Object-oriented programming (OOP) is centered on creating objects. An object is a software entity that contains both data and procedures. The data contained in an object is known as the object’s fields. An object’s fields are simply variables, arrays, or other data structures that are stored in the object. OPPs group the data methods together so that each can operate on its own data while procedures are used to directly perform operation on data structures. OPP provides encapsulation making class whose objects can be created dynamically. OPPs have been observed to give lower quality performance as compared to procedural programming. In addition to solving the problems of code-data separation, the use of OOP has also been encouraged by the trend of object reusability. An object is not a standalone program, but is used by programs that need its service. (Gaddis, 2010) References Gaddis, T. (2010). Starting out with programming logic and design. (2 ed.). Pearson Education, Inc.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.