Difference Between OOP and Procedural Programming Language (a review)

Introduction

In this paper I will discuss the differences between procedural programming hereafter referred to as PROCEDURAL PROGRAMMING and object oriented programming hereafter referred to  as OBJECT-ORIENTED PROGRAMMING. I will discuss some of the benefits of using both languages as well as some of the difficulties in using each.

I will also discuss some important concepts that must be understood in using each language and how they compare to each other. After reviewing concepts I will discuss the design and development process for each language, followed by the advantages and disadvantages of each programming language.

Finally I will discuss the reusability and maintainability of each language, and how they differ from each other.

Object-Oriented Programming Languages

OBJECT-ORIENTED PROGRAMMING is a programming language that uses classes and objects to create models based on the real world environment. An OBJECT-ORIENTED PROGRAMMING aProcedural Programminglication may use a collection of objects which will pass messages when called upon to request a specific service or information. Objects are able to pass, receive messages or process information in the form of data.

One reason to use OBJECT-ORIENTED PROGRAMMING is because it makes it easy to maintain and modify existing code as new objects are created inheriting characteristics from existing ones (SEH, 2013). This cuts down the development time considerably and makes adjusting the program much simpler.

Another reason to use OBJECT-ORIENTED PROGRAMMING is the ease of development and ability for other developers to understand the program after development. Well commented objects and classes can tell a developer the process that the developer of the program was trying to follow. It can also make additions to the program much easier for the new developer.

The last reason to use OBJECT-ORIENTED PROGRAMMING that I will mention here is the efficiency of the language. Many programming languages using OBJECT-ORIENTED PROGRAMMING will dump or destroy unused objects or classes freeing up system memory. By doing this the system can run the program faster and more effectively.

Procedural Programming Languages

PROCEDURAL PROGRAMMING which at times has been referred to as inline programming takes a more top down aProcedural Programmingroach to programming. OBJECT-ORIENTED PROGRAMMING uses classes and objects, PROCEDURAL PROGRAMMING takes on aProcedural Programminglications by solving problems from the top of the code down to the bottom.

This haProcedural Programmingens when a program starts with a problem and then breaks that problem down into smaller sub-problems or sub-procedures. These sub-procedures are continually broken down in the process called functional decomposition until the sub-procedure is simple enough to be solved.

The issue that is obvious in PROCEDURAL PROGRAMMING is that if a edit is needed to the program, the developer must edit every line of code that corresponds to the original change in the code. An example would be if at the beginning of a program a variable was set to equal the value of 1. If other sub-procedures of the program rely on that variable equaling 1 to function properly they will also need to be edited. As more and more changes may be needed to the code, it becomes increasingly difficult to locate and edit all related elements in the program.

Simple comparison between OBJECT-ORIENTED PROGRAMMING and PROCEDURAL PROGRAMMING

A simple way to compare both programming methods is to think of OBJECT-ORIENTED PROGRAMMING as  learn to read picture book. As children see pictures of simple objects like a house or picture they know that throughout the book when they see a picture of the house it represents the word house. The children can then read through the book as words are substituted throughout the story with pictures.

In OBJECT-ORIENTED PROGRAMMING the classes could represent the pictures in the learn to read books. A house could represent a class and anything the developer wants to have included to describe that house like the color, size, number of bathrooms etc.

In PROCEDURAL PROGRAMMING the learn to read book would be words on the page without pictures to help guide the young learner through the book. If the story was changed in the beginning of the book it could disrupt or make the story later on in the book not make any sense. Although learning to read the book would make programming with PROCEDURAL PROGRAMMING simple, it would make it difficult for other readers in the case of the book or programmers in the case of PROCEDURAL PROGRAMMING to add to the story.

PROCEDURAL PROGRAMMING also uses different methods throughout the code than OBJECT-ORIENTED PROGRAMMING. As an example OBJECT-ORIENTED PROGRAMMING uses methods where PROCEDURAL PROGRAMMING uses procedures. OBJECT-ORIENTED PROGRAMMING uses objects where PROCEDURAL PROGRAMMING uses records. OBJECT-ORIENTED PROGRAMMING uses classes where PROCEDURAL PROGRAMMING uses modules and OBJECT-ORIENTED PROGRAMMING uses messages where PROCEDURAL PROGRAMMING uses procedure calls . In addition OBJECT-ORIENTED PROGRAMMING uses data fields where PROCEDURAL PROGRAMMING uses procedures.  A chart has been provided below to illustrate the differences between the two:

Procedural

Object-oriented

procedure method
record object
module class
procedure call message

(Wikipedia, 2013)

Beyond the major differences listed in the chart there are also some detailed differences that were not listed. As an example OBJECT-ORIENTED PROGRAMMING classes have data fields that are a part of that class. If there was a class called dog some of the data fields might be eye color, breed etc. In PROCEDURAL PROGRAMMING the data is not the focus and would not be introduced until needed in the program. With PROCEDURAL PROGRAMMING the program would wait until the flow of the program got to the data vs. OBJECT-ORIENTED PROGRAMMING where the data would be stored when the class was loaded.

Important design concepts

The design process for each method of programming differs in many ways. With OBJECT-ORIENTED PROGRAMMING, designs can be reused and recycled throughout the program where PROCEDURAL PROGRAMMING is usually not able to do this. Additionally planning out the process of the design is much different with PROCEDURAL PROGRAMMING than it is with OBJECT-ORIENTED PROGRAMMING.

First we will look at important design processes for OBJECT-ORIENTED PROGRAMMING and then PROCEDURAL PROGRAMMING. Although I may not include every element used in each design process, I will cover major design elements to help illustrate the differences between the two methods of programming.

OBJECT-ORIENTED PROGRAMMING Design Concepts

When developing with OBJECT-ORIENTED PROGRAMMING a developer does not simply sit down and begin to write out code on a page that comes to their mind. The aProcedural Programminglication must be planned out in a series of steps and diagrams.

When first developing a new program a programmer must determine what the program must do and how it will function. If the program is a grading system the developer might need to know who will be using the system, what access they will have, if they need to add, edit or delete the data in the system, what data will actually be stored etc. Planning out the system can be a very difficult and time consuming task, but without proper planning the aProcedural Programminglication could have difficulty functioning properly.

When planning out the design of a OBJECT-ORIENTED PROGRAMMING a developer will usually start with a list of classes that need to be included in the program. For a grading system there might be classes for users, grades, schools etc depending on what data was being stored in the system and how the data relates to each other.

Once a developer has an idea of what classes should be used in the aProcedural Programminglication they will usually draw out the system using diagrams such as the class diagram to illustrate the system. During this process of illustration the designer is able to make edits to the system and check for errors in functionality. As the developer moves through the diagram including functions and methods it makes the aProcedural Programminglication make more visual sense and often makes clearing up any issues easier.

Developers will often break down the program into activity and other diagrams to illustrate functions of the program in greater detail. These diagrams make developing the aProcedural Programminglication or program much easier when it comes time for actual coding.

Once the planning has finished and the developer has the development plans ready usually in the form of diagrams, it is finally time to actually begin coding. The process of coding the aProcedural Programminglication is much simpler once the diagrams are in place simply because it is like building a house from blue-prints. As long as the developer knows how to follow the plans and build according to them, the building of the aProcedural Programminglication stays manageable.

PROCEDURAL PROGRAMMING Design Concepts

When developing with PROCEDURAL PROGRAMMING a developer may take a much different aProcedural Programmingroach to designing an aProcedural Programminglication. PROCEDURAL PROGRAMMING takes a more top down aProcedural Programmingroach to writing an aProcedural Programminglication and while a developer who uses OBJECT-ORIENTED PROGRAMMING to create aProcedural Programminglications would think of planning out the program with re-usable classes, a developer who uses PROCEDURAL PROGRAMMING might plan out the program without the idea of recycling code.

Planning is still involved in PROCEDURAL PROGRAMMING but it takes a much more literal aProcedural Programmingroach. In the case of a grading system, instead of thinking about what classes or objects will need to be used with functions and methods, a PROCEDURAL PROGRAMMING programmer may think in terms of how the program should execute as the code is executed.

PROCEDURAL PROGRAMMING aProcedural Programminglications are planned out more like a story format than a diagram format. A developer would still need to list out who is using the program and what they will need to access, but the code is not reused in the same was as OBJECT-ORIENTED PROGRAMMING. By coding in this way it makes the development process much simpler but also more time consuming.

For example a PROCEDURAL PROGRAMMING developer who is building the grade system might first create a form where a user can register to access the system. The data that is captured by the form would then need to be verified with some kind of method and then stored into a database of some kind. After the user submitted the form and the data was verified, a confirmation would need to be displayed to the user letting them know the status of their registration.

This entire process in PROCEDURAL PROGRAMMING would be coded directly into the aProcedural Programminglication and would only be useful for the process of registering the user. Other processes such as logging on and logging off would all be separate processes that would need to be coded into the aProcedural Programminglication.

Unlike OBJECT-ORIENTED PROGRAMMING where objects and classes can be referenced throughout the program, problems being solved in PROCEDURAL PROGRAMMING would need to be individually addressed as the program is executed.

Summary of important design concepts

When designing in OBJECT-ORIENTED PROGRAMMING or PROCEDURAL PROGRAMMING languages, the developer will need to have a plan for the program before actually writing any code. PROCEDURAL PROGRAMMING can be a tempting solution for many developers because it means they can usually jump into coding quicker, but it can be a time consuming solution later when changes to the code are needed.

Additionally the up-front planning that is involved in OBJECT-ORIENTED PROGRAMMING can pay off in the long run when changes or additions are needed and during the debugging process where errors can be traced more directly to the class or object it is associated with.

Design and development process

As discussed earlier in the important design concepts area of this paper, there are many different processes when developing in PROCEDURAL PROGRAMMING or OBJECT-ORIENTED PROGRAMMING. I will discuss in this section some of the differences between the development process in OBJECT-ORIENTED PROGRAMMING and the development process in PROCEDURAL PROGRAMMING.

Development in OBJECT-ORIENTED PROGRAMMING

When developing in OBJECT-ORIENTED PROGRAMMING you begin with diagramming and planning out the program. Classes are constructed and data fields are associated to help the developer in the planning process. As the classes are built, functions and methods can be introduced to help in the planning of the program.

Once the classes and objects have been planned out and diagramed the program can begin to take shape in a development environment. It is only after the program has been planned out that this can haProcedural Programmingen.

Planning out the classes in OBJECT-ORIENTED PROGRAMMING is an essential part of the development process in OBJECT-ORIENTED PROGRAMMING. It gives the basic blueprints of the program to work off of when building it. Additionally the planning phase can uncover problems in the design that are easier to fix in the beginning of the process than later during actual development.

Tools for development in OBJECT-ORIENTED PROGRAMMING

When developing in OBJECT-ORIENTED PROGRAMMING there are many tools available that will aid the programmer while developing. Many languages have software built to help aid developers while coding in their language.

An example of a good OBJECT-ORIENTED PROGRAMMING language that uses software to help the developer is JAVA. Java has many different functions and many different software programs that help in the development processes. One of these programs is Eclipse which helps in the development of aProcedural Programminglications for both the web and others. One of the largest aProcedural Programming markets Android runs aProcedural Programminglications built on the Eclipse platform.

Eclipse like many other programs has a simple user interface to allow for program creation and testing. For developers who are very familiar with the language and OBJECT-ORIENTED PROGRAMMING principles, there is a text editor for direct editing of code.

For developers who are not as experienced there is a GUI interface that allows for visual editing of aProcedural Programminglications. This GUI interface allows the developer to drag and drop elements onto the page where the program resides in a visual fashion. After the program is situated visually it can then be switched to the text editor mode to make adjustments to the code.

The GUI interface adds code to the text editor as elements are droProcedural Programminged onto the page. This makes editing the code much easier for the developer because the code is already written and will only need minor edits to work correctly.

As code is written in either the text editor or GUI interface, developers are able to test their code for errors and to make sure it is functioning as expected. Eclipse will display errors throughout the code if there are any otherwise it will display no errors. Developers can then run the program directly from Eclipse to test functionality and processes that were originally in the programs design.

Eclipse is just one program that assists in development of the OBJECT-ORIENTED PROGRAMMING language JAVA. There are many other OBJECT-ORIENTED PROGRAMMING languages and programs that assist in development of OBJECT-ORIENTED PROGRAMMING languages. Many of the programs are similar and make development in OBJECT-ORIENTED PROGRAMMING much easier on developers. It also makes developing in other OBJECT-ORIENTED PROGRAMMING languages much easier to learn because they are similar.

Development in PROCEDURAL PROGRAMMING

When developing in PROCEDURAL PROGRAMMING you start first with the main functions or as some call it the common procedures. This main function is the main goal of the system, or what it is suProcedural Programmingosed to do for the person using it.

When planning out a program in PROCEDURAL PROGRAMMING it is very different from OBJECT-ORIENTED PROGRAMMING. In OBJECT-ORIENTED PROGRAMMING you would plan out the classes and data types. You would also diagram out the program to display how classes should associate with and communicate with each other. In PROCEDURAL PROGRAMMING you plan out the program in a storyboard fashion. The main function is first decided and then broken down into individual more manageable problems that can then be solved.

PROCEDURAL PROGRAMMING focuses on the main goal of a program first, and then identifies the smaller components that will solve the main goal. By following this method of programming it helps developers see the details in the overall picture.

Tools for development in PROCEDURAL PROGRAMMING

Much like OBJECT-ORIENTED PROGRAMMING there are many different programs that assist developers who use PROCEDURAL PROGRAMMING as their method of choice. Unlike OBJECT-ORIENTED PROGRAMMING, PROCEDURAL PROGRAMMING can use a much wider array of programs to develop with. The reason for this is because most code in PROCEDURAL PROGRAMMING can be written in anything from Microsoft word to Adobe Dreamweaver.

The top down aProcedural Programmingroach that is used in PROCEDURAL PROGRAMMING makes developing in it very easy for most programs. Developers who use PROCEDURAL PROGRAMMING usually like to have extensive comments and indentations to visually explain what is haProcedural Programmingening in their sometimes lengthy code. With these desires in mind, programs that are used for PROCEDURAL PROGRAMMING often have these abilities plus many more such as auto completes for coding to help speed up the process.

As mentioned earlier, Adobe Dreamweaver is often a program of choice for many PROCEDURAL PROGRAMMING developers. Dreamweaver has the ability much like Eclipse to develop in text or with a GUI. Depending on what language is being coded will change the user friendliness of the aProcedural Programminglication.

Developers who code with HTML may find using the GUI very useful, where developers who are programming in PHP may find the GUI interface very pointless.

Adobe Dreamweaver like many other programs is simply a software that helps aid in the development process. It can be used in both OBJECT-ORIENTED PROGRAMMING and PROCEDURAL PROGRAMMING but it is preferred by many PROCEDURAL PROGRAMMING programmers because it has the ability to auto complete and display code in a visually pleasing way.

Advantages and disadvantages

There are many advantages to programming in both OBJECT-ORIENTED PROGRAMMING and PROCEDURAL PROGRAMMING languages. Many argue the superiority of each method, but both serve their purpose and both have their advantages and disadvantages.

Advantages of OBJECT-ORIENTED PROGRAMMING

The obvious advantages of using OBJECT-ORIENTED PROGRAMMING is its reliability and sustainability across different platforms. Developers who have experience programming in JAVA would also be qualified to develop in C# or JQuery which have very similar syntax. The benefit to employers looking for developers with a special area of expertise is that they are able to train with ease developers who have OBJECT-ORIENTED PROGRAMMING experience vs. the ones who don’t.

Another advantage of OBJECT-ORIENTED PROGRAMMING is the ease of debugging the code. Errors that may exist during development can usually be tracked to a point of origin and then fixed eliminating other errors throughout the entire program. Having this ability cuts out many hours of debugging and code adjustments that may be necessary with PROCEDURAL PROGRAMMING.

The last advantage I will talk about is the logical structure of OBJECT-ORIENTED PROGRAMMING. The ability to relate code to real world examples makes the process much easier and more simple to code. Unlike PROCEDURAL PROGRAMMING where you make adjustments as you go, in OBJECT-ORIENTED PROGRAMMING you have the majority of your program diagrammed out before you ever type out lines of code

Disadvantages of OBJECT-ORIENTED PROGRAMMING

One disadvantage of OBJECT-ORIENTED PROGRAMMING is the difficulty of understanding how objects, classes, methods, actions etc relate to each other. Especially for those who are used to a PROCEDURAL PROGRAMMING aProcedural Programmingroach to programming this may be very difficult.

Another disadvantage of OBJECT-ORIENTED PROGRAMMING is the requirement to have packages and libraries installed for the code to function properly. These libraries are meant to make the coding process much easier for the developer, but for some who prefer to write out line by line their code it could become confusing and difficult to understand.

Advantages of PROCEDURAL PROGRAMMING

One glaring advantage of PROCEDURAL PROGRAMMING is the ability to jump right into coding a program without the need to create any objects or classes. Many programmers prefer this method because they want to be able to write small amounts of code in a short period of time without the need to plan it out. Examples could include simple forms or html pages with basic data displayed.

Another advantage of PROCEDURAL PROGRAMMING is the ability to learn the language easily. Many developers begin their education by copying code from the internet and then pasting it in an aProcedural Programminglication to run. With OBJECT-ORIENTED PROGRAMMING there is more to do besides just copying and pasting code, but in PROCEDURAL PROGRAMMING that is generally an acceptable way to build a program.

The top down structure is also an advantage for those who prefer to work their way through a program vs. planning the program out before the development process. Many developers who are creative prefer to write their code out like reading a story, discovering and creating along the way.

Disadvantages of PROCEDURAL PROGRAMMING

A major disadvantage of using PROCEDURAL PROGRAMMING as a method of programming is the inability to reuse code throughout the program. Having to rewrite the same type of code many times throughout a program can add to the development cost and time of a project.

Another disadvantage is the difficulty in error checking. In PROCEDURAL PROGRAMMING the code is continuously broken down into smaller manageable pieces until the different problems or functions can be executed. With this aProcedural Programmingroach finding errors in the code becomes more and more difficult as the code gets longer and longer.

The last disadvantage I will speak about is the difficulty for developers who use PROCEDURAL PROGRAMMING as their aProcedural Programmingroach to programming to move from language to language. Without a knowledge of OBJECT-ORIENTED PROGRAMMING it is very difficult for a developer to be qualified in many languages who use this method. Instead the programmers would be required to learn each new language individually in order to code in it. OBJECT-ORIENTED PROGRAMMING lays a basic groundwork that is used in hundreds of languages.

Reusability and maintainability

One of the main advantages of OBJECT-ORIENTED PROGRAMMING over PROCEDURAL PROGRAMMING is its reusability and maintainability. OBJECT-ORIENTED PROGRAMMING is built in a way that it can be updated and adjusted with relative ease making it a clear choice for those who are looking for a method of programming that will save them time and money in the long run.

I will discuss some of the differences here in depth between OBJECT-ORIENTED PROGRAMMING and PROCEDURAL PROGRAMMING and their reusability and maintainability.

OBJECT-ORIENTED PROGRAMMING reusability and maintainability

As mentioned earlier a key advantage of OBJECT-ORIENTED PROGRAMMING is its reusability and maintainability. When thinking of code as reusable it is often thought of as being put in a library to be extracted later. Although this is true for most methods of programming and is true for OBJECT-ORIENTED PROGRAMMING, this is not the type of reusability I will talk about.

When referring to reusability in OBJECT-ORIENTED PROGRAMMING the code itself can be reused throughout the aProcedural Programminglication. An example would be the creation of a super class that can have its attributes inherited into other classes. A super class might be a dog and sub-classes that inherit attributes from the dog class could be collie or pit bull. Both of these other classes have dog attributes but are also unique from each other.

In this way code can be reused throughout the program mitigating the need for developers to rewrite the dog class over and over throughout the code every time there is a new dog introduced.

With the code being reused in this manner it can be maintained in a similar way. As in our previous example if the program required that every dog be classified with a certain hair color, the developer could change the super class dog to have a hair color of say blonde. This would then change all the dog classes that inherit hair color from the super class throughout the program.

As maintenance arises and updates are needed, OBJECT-ORIENTED PROGRAMMING cuts out many hours of updating code by relating the code together in a way that relates to real world scenarios. This also makes it much easier for the developer to maintain the aProcedural Programminglication.

PROCEDURAL PROGRAMMING reusability and maintainability

Unlike OBJECT-ORIENTED PROGRAMMING, PROCEDURAL PROGRAMMING reusability and maintainability are looked at in a very different fashion. PROCEDURAL PROGRAMMING methods and code is often stored in a library which can be accesses at a later date by other developers. This library usually is made up of different actions that are used over and over again in a program.

An example of one of these actions would be a contact form on a web page. The contact form might be displayed in html, styled with CSS and executed with JavaScript. All of these files would be stored together in a library which could then be reused over and over again when someone would need a contact form on their website.

Although this method is simple and easy in theory it presents many problems to new developers. For instance not all libraries are written in a way that is understandable to an average coder. This makes using code from a library difficult and sometimes dangerous to the wrong people.

In addition, using code from libraries can make maintenance difficult if not impossible. Some libraries have their own external files such as JQuery. As code is updated throughout time, aProcedural Programminglications that rely on the code library may have bugs or cease to function making it a necessity for the developer to recode or find a new library with the action they are looking for.

Beyond libraries, PROCEDURAL PROGRAMMING code can be reused over and over again throughout an aProcedural Programminglication as problems are continually broken down over and over again. Some functions such as search and replace have made updating this type of code easier, but unlike OBJECT-ORIENTED PROGRAMMING, PROCEDURAL PROGRAMMING requires that all out of date code is updated for the program to work. This has proven over time to be a very large difficulty for many PROCEDURAL PROGRAMMING developers.

Well known aProcedural Programminglications

Many well known aProcedural Programminglications use OBJECT-ORIENTED PROGRAMMING. While researching programs that use the PROCEDURAL PROGRAMMING aProcedural Programmingroach it was very difficult for me to find any up to date programs or aProcedural Programminglications that do. As an example the top ten visited websites on the internet all use OBJECT-ORIENTED PROGRAMMING as their programming method of choice (Wikipedia, 2013). I will focus mainly on some varied aProcedural Programminglications that use OBJECT-ORIENTED PROGRAMMING as their method.

Well known OBJECT-ORIENTED PROGRAMMING aProcedural Programminglications

Android

The android market recently surpassed the iPhone market in users and aProcedural Programmings. Android aProcedural Programminglications are built in the language of JAVA and can be developed using Eclipse. Many have argued that android aProcedural Programminglications are in much higher demand now more than ever creating a higher demand for OBJECT-ORIENTED PROGRAMMING developers familiar with eclipse (Android, N/A).

Youtube.com

One of the most popular video sharing sites, youtube has averaged about 800,000,000 unique visitors since it went live (Wikipedia, 2013). The primary languages that are used in this website are C, Python and JAVA, all of which are OBJECT-ORIENTED PROGRAMMING languages.

Oanda Currency Exchange

Another JAVA aProcedural Programminglication is the Oanda Currency Exchange. Traders and bankers use the java aProcedural Programminglication on the site to view real time exchange rates and to trade currencies with other banks and institutions throughout the world (Oanda Currency Exchange, N/A).

Summary

During this paper I have discussed the important design concepts of both PROCEDURAL PROGRAMMING and OBJECT-ORIENTED PROGRAMMING methods. I have also talked about the design and development process as well as the reusability and maintainability of each method. I finished up by talking about the advantages and disadvantages of each program with major aProcedural Programminglications that use OBJECT-ORIENTED PROGRAMMING as their primary method of programming.

Conclusion

As I researched and prepared for this paper I not only learned some distinct advantages of using OBJECT-ORIENTED PROGRAMMING, I also was able to better understand the benefits associated with it. I was able to realize the major benefits to me personally it will be to use more OBJECT-ORIENTED PROGRAMMING in my daily work.

Add Comment Register



Leave a Reply

Your email address will not be published. Required fields are marked *