Sample Essay On Comparison: The Advantages Of Oop And Structured Programming:
Structured programming is a programming paradigm based on dividing a program/system into composition sub-programs/systems using a top-down approach. The computer program is thus organized into hierarchical modules, each with a single entry point and a single point of exit. Control structures are used to pass down control throughout out the code structure since they determine the exact order in which a set of instructions is to be executed. Examples of control structures used in sequence, iteration, and test structures (Structured Programming, 2015).
Advantages of structured programming:
Structured programming addresses to a great extent and solves the issue of complexity in computer programming. This because a complex program, is broken down into modules that can be tackled individually. Modularity also allows the programmer to solve problems in a logical manner while the use of control structures ensures that the flow of control is exact and clear.
Another advantage of modularity is increased productivity since a team of programmers can work on the project simultaneously, each working independently on a single module. The modules are later recombined to form the whole program. Another advantage is that modules can be re-used many times which help reduce the complexity, save time and increase reliability since tested and proven modules are less likely to have errors. Finally, is easier to isolate and fix errors, update or replace individual program modules instead of changing the whole code structure (Structured Programming, 2015).
Object Oriented Programming:
On the other hand, object-oriented programming (OOP) solves programming problems using objects. An object is the basic program unit in OOP, and it refers to a program component that performs a certain task and can interact with other elements in the programs. Objects are created based on a template known as a class. The class is used as an object blueprint to define the variables and methods in a specific kind of object. In this case, an object is an instantiation of a class containing real data values instead of the variables. An example of an object is a person. The person object has a specific name which is considered in OOP as an attribute/property. The person is also expected to perform some task such as walking, and the task is considered as the method of the object.
Advantages of Object Oriented Programming:
Object Oriented Programming has an upper hand when it comes to achieving simplicity i.e. objects are used to model real-world objects thus reducing complexity, and making the program becomes clearer. OOP also helps achieve modularity since each object is a separate entity whose internal working is hidden from other elements in the system. OOP also makes it easy to modify program components since changes made in a class have no effect on any other part of the program i.e. the only public interface of a class accessible by external objects is through the use of methods belonging to the class (Eprints.soton.ac.uk, 2014).
Extensibility is another benefit of OOP since new objects can be introduced easily while existing objects can be modified to add new features or respond to changes in the operating environment. Object re-usability is another benefit of OOP since objects can be re-used in different applications. Finally, objects can be individually isolated for maintenance which makes the location and fixing of problems and easy task (Eprints.soton.ac.uk, 2014).
Example of a program:
An example of an application I’d like to see developed is a project management application using OOP methodology. This because OOP can be used to model real world processes, concepts and things suitable for the application. For example, in a project management application, objects in the application would include a project status object, the client object, cost object, time object among others. The project status object would show the current project status and have a method to update the status. The properties of the client object would include all important client details and methods to update them. The project cost object would have methods of calculating the project cost based on the work hours, cost of materials, hourly rate and client fees.
Eprints.soton.ac.uk,. (2014). Object Oriented Basic Concepts and Advantages. Retrieved 15 January 2015, from http://eprints.soton.ac.uk/250857/3/html/node3.html
Structured Programming. (2015) (1st ed., pp. 6-10). San Luis Obispo, California. Retrieved from http://users.csc.calpoly.edu/~jdalbey/308/Resources/StructuredProgramming.pdf