Education Portal is now Study.com! Same great content, just under a new name. Learn more
Copyright

Object Oriented Programming vs. Procedural Programming

  • 0:05 Programming Paradigms
  • 0:51 Procedural Programming
  • 1:48 Object-Oriented Programming
  • 3:17 Key Differences
  • 5:52 OOP Most Popular
  • 6:31 Lesson Summary
Create An Account
To Start This Course Today
Used by over 10 million students worldwide
Create An Account
Try it free for 5 days
Lesson Transcript
Instructor: Paul Zandbergen

Paul has a PhD from the University of British Columbia and has taught Geographic Information Systems, statistics and computer programming for 15 years.

There are several alternative approaches to the programming process. Two of the most important approaches are procedural programming and object-oriented programming. Learn about the differences between these two approaches in this video lesson.

Programming Paradigms

Programming is a creative process carried out by programmers to instruct a computer on how to do a task. A program is a set of instructions that tells a computer what to do in order to come up with a solution to a particular problem. There are a number of alternative approaches to the programming process, referred to as programming paradigms. Different paradigms represent fundamentally different approaches to building solutions to specific types of problems using programming. Most programming languages fall under one paradigm, but some languages have elements of multiple paradigms. Two of the most important programming paradigms are the procedural paradigm and the object-oriented paradigm. Let's look at each of these in a bit more detail.

Procedural Programming

Procedural programming uses a list of instructions to tell the computer what to do step-by-step. Procedural programming relies on - you guessed it - procedures, also known as routines or subroutines. A procedure contains a series of computational steps to be carried out. Procedural programming is also referred to as imperative programming. Procedural programming languages are also known as top-down languages.

Procedural programming is intuitive in the sense that it is very similar to how you would expect a program to work. If you want a computer to do something, you should provide step-by-step instructions on how to do it. It is, therefore, no surprise that most of the early programming languages are all procedural. Examples of procedural languages include Fortran, COBOL and C, which have been around since the 1960s and 70s.

Object-Oriented Programming

Object-oriented programming, or OOP, is an approach to problem-solving where all computations are carried out using objects. An object is a component of a program that knows how to perform certain actions and how to interact with other elements of the program. Objects are the basic units of object-oriented programming. A simple example of an object would be a person. Logically, you would expect a person to have a name. This would be considered a property of the person. You would also expect a person to be able to do something, such as walking. This would be considered a method of the person.

A method in object-oriented programming is like a procedure in procedural programming. The key difference here is that the method is part of an object. In object-oriented programming, you organize your code by creating objects, and then you can give those objects properties and you can make them do certain things.

A key aspect of object-oriented programming is the use of classes. A class is a blueprint of an object. You can think of a class as a concept, and the object as the embodiment of that concept. So let's say you want to use a person in your program. You want to be able to describe the person and have the person do something. A class called 'person' would provide a blueprint for what a person looks like and what a person can do. Examples of object-oriented languages include C#, Java, Perl and Python.

Key Differences

One of the most important characteristics of procedural programming is that it relies on procedures that operate on data - these are two separate concepts. In object-oriented programming, these two concepts are bundled into objects. This makes it possible to create more complicated behavior with less code. The use of objects also makes it possible to reuse code. Once you have created an object with more complex behavior, you can use it anywhere in your code.

Let's look at a simple example of this. You want to write a program that plays a song. Your band playing the song will have four members, and you start off by given each of them a name:

myband = ('John,' 'Paul,' 'George,' 'Ringo')

Now that you have your band, it's time to pick the song:

mysong = 'Yellow Submarine'

Now you want your band to play the song, so you need two more things. First, you need to have the lyrics and the notes of the song. Second, each band member needs to know what to do: perform vocals, play a particular instrument or both. We'll just consider the first requirement here.

In procedural programming you will need to include all the text and notes in the program so the band members can play it. However, you want to have another band play the song in another program. In procedural programming, you could copy and paste the code into another program so there is no need to manually type the same text again. However, why not save the text into a separate file and every time your band - or any band for that matter - wants to play that song, you simply call up the file. That way, your code for the song itself never needs to get duplicated.

To unlock this lesson you must be a Study.com Member.
Create your account

Unlock Your Education

See for yourself why 10 million people use Study.com

Become a Study.com member and start learning now.
Become a Member

Already a member? Log In

Start Your Free Trial To Take This Quiz

As a member, you'll also get unlimited access to over 8,500 lessons in math, English, science, history, and more. Plus, get practice tests, quizzes, and personalized coaching to help you succeed.

Free 5-day trial
It only takes a few minutes to set up and you can cancel at any time.
Already registered? Login here for access

Earning College Credit

Did you know… We have over 100 college courses that prepare you to earn credit by exam that is accepted by over 2,900 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? Study.com has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.