Object-Oriented Programming Term Paper

Total Length: 1739 words ( 6 double-spaced pages)

Total Sources: 4

Page 1 of 6

Object Oriented Programming

The programming language that is organized around data rather than actions, and objects instead of actions is referred to as object oriented programming Mitchell, 2003.

A program has always been viewed as a logical procedure which accepts input data, processes the data, and produces some output. Object oriented programming was developed out of the need to write the logic instead of how to define the data. In object oriented programming the objects that the programmer wants to manipulate take center stage and not the required logic of manipulating the objects. An object is defined as a composition of nouns like strings, variables or numbers and verbs like functions. A program that is object oriented is a collection of objects that are interacting. A conventional program model was viewed as a list of tasks that the program was required to perform. Each of the objects used in OOP has the capability to process, receive and send messages to the other objects. The objects used in OOP are all viewed as independent and with distinct roles.

The popularity of OOP was mainly because of its simplicity in writing code, and it is easy for programmers to understand. Its adoption by many software development companies was because of its power and simplicity. Using abstraction, encapsulation, and polymorphism has helped programmers in managing their code and reducing program complexity. Data modeling is the first step in OOP. This stage allows the programmer to define and identify the objects that they want to manipulate and the way the objects will relate with each other.

Encapsulation

Encapsulation is defined as the placing of data and its operands in the same class. Encapsulation allows the programmer to hide information from other people Bruce, 2002.

This usually occurs by using the word "private" before the component. This way the programmer will be able to prevent other people from changing his implementations behavior. The concept of placing the private keyword is used for classes like link list, heap, and array. In many scenarios, people do not need to know how the classes are implemented, but they have to be included in the program. Using encapsulation more details can be added to the code and the additions will not affect the private classes/sections of the code. Using encapsulation an object's internal representation is hidden from view by the objects outside its definition. Therefore, it is the object's own methods that can manipulate or directly inspect its fields. Encapsulation has the benefit of reducing a program's complexity and increases its robustness, which allows the developer to limit the interdependencies of the software components.

Inheritance

Inheritance is a concept of OOP where a new class uses the implementation of another already defined class. Inheritance allows the reuse of existing code without the need for modification, but a little modification can be performed Craig, 2007.

Inheritance can also be defined as a way of establishing relationships between objects. In a situation where objects are defined by classes, the classes can inherit behavior and attributes from existing classes, which are referred to as parent classes or base classes. The classes resulting from inheritance are referred to as subclasses or child classes. Inheritance is used to show hierarchy between classes. Using inheritance a programmer is able to reduce the amount of code used as there will not be any replication required. Inheritance will allow for code reusability.

Polymorphism

Polymorphism is the ability to create a function, object, or variable that has many forms. This is the ability of substituting a class for another. Using polymorphism different classes can have the same method name, but they will all return different results because they all have different codes in their methods. Without having to understand the object type polymorphism is a great way of communicating between objects.

Procedural programming vs. Object oriented programming

Procedural programming focuses mainly on the actions or procedures that will take place within the program. A procedure call is one of the concepts in procedural programming. A procedure normally contains some list of instructions that will be carried out by the program. The procedure can be called by the program at any time by another procedure. Examples of procedural languages are Pascal and C. OOP focuses on solving the problem in terms of real-world elements. It also represents the problem as objects and object behavior. An object is a data structure that contains methods and data fields, which represent behaviors of real-world objects and attributes. Examples of OOP languages are C# and Java. These programs can also be used in procedural programming.
OOP represents problems using real world objects while procedural programming represents solutions to problems by using procedures. These procedures are code collections that are run in a specified order. OOP is quite like the real-world. Objects are not able to access directly the other object's data, but they have to request for data to be sent to them. This is similar to human beings requesting for information from other humans. Procedural programming breaks down the task of programming into subroutines and variables, while OOP breaks down the task into objects that encapsulate methods and data. A step-by-step program is created in procedural programming, which will guide the application in a sequence of instructions. In procedural programming, the programmer has access to all the data and functions that are executed. The programmer is also able to modify these data and functions.

Advantages of object oriented programming

OOP offers an improved productivity in software development. Object oriented programming allows for the separation of tasks between different people or teams. This is referred to as modular programming Marrer ()

. Objects can be extended, which allows for the inclusion of new behaviors and attributes. Objects created are easily reused across the application. This reduces the number of code used in the program and also reduces the errors. Code reusability also speeds up the program development as less time is spent rewriting the same code. Since it uses these three approaches modularity, reusability, and extensibility, OOP provides for improved productivity in software development over the traditional forms of programming.

OOP has improved software maintainability. Software developed using OOP is easier to maintain mainly due to the following reasons modularity, reusability, and extensibility. Any part of the program can be updated without the need of large-scale changes. This allows for any issues to be sorted out easily and without affecting the whole program. This is because the design is modular. OOP also offers a faster development of programs. Using its rich objects libraries, and code developed in other projects, a programmer is able to reuse the objects and code for future projects. This save the programmer time and allows them to make use of what they had developed before. Code developed by other programmers can also be reused easily as OOP simplifies the code and makes it easy for others to understand.

The cost of development is lowered as OOP allows for the reuse of software. Reusing software reduces the overall cost of developing a program as old programs that had been tested and approved can be reused for new projects. This way more effort will be placed on object oriented design and analysis instead of other features. OOP requires programmers to undergo an extensive planning phase, which ensures that the program design is flawless. This delivers better program designs. As a program becomes large, it is quite easy to program OOP than traditional forms of programming.OOP provides and delivers a higher software quality. Since less time is spent developing the program, more resources can be allocated to program testing and verification, which ensures that the program meets the expected standards. In other programming languages, the quality of the program is directly dependent on the teams' experience, but using OOP quality can be guaranteed without using experienced programmers.

Disadvantages of object oriented programming

OOP has a steep learning curve. The techniques used in OOP like polymorphism and inheritance can be quite difficult to comprehend initially. This would create challenges for programmers who are not used to OOP. OOP requires some specific thought process, which may not be natural to all programmers. This will result in them taking longer in getting used to OOP. It is also quite complex to develop programs based on object interactions. Object oriented programs normally have more lines of code than traditional forms of programming. This means that programmers will have to write more lines of code even if they have the capability of reusing some of the code. An increase in the number of code used leads to an increase in the rate of error. Therefore, OOP has the potential of generating more errors that the other forms of programming.

Programs developed using OOP are relatively slower than procedural programs, as they require the execution of more instructions. OOP uses code reuse and modular programming, this results in different classes been called, which increases the number of instructions executed. OOP is not suited to solving all types of….....

Need Help Writing Your Essay?