Copyright
Like?

Object Oriented Programming vs. Procedural Programming

Start Your Free Trial To Continue Watching
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 minute. You can cancel at any time.
Already registered? Login here for access.
Start your free trial to take this quiz
As a premium member, you can take this quiz and also access over 8,500 fun and engaging lessons in math, English, science, history, and more. Get access today with a FREE trial!
Free 5-day trial
It only takes a minute to get started. You can cancel at any time.
Already registered? Login here for access.
  1. 0:05 Programming Paradigms
  2. 0:51 Procedural Programming
  3. 1:48 Object-Oriented Programming
  4. 3:17 Key Differences
  5. 5:52 OOP Most Popular
  6. 6:31 Lesson Summary
Show Timeline
Taught by

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.

This is exactly what object-oriented programming does. In technical terms, you would use a class called 'song' to create an object, 'Yellow Submarine.' This object has a number of properties, including lyrics and music notes. The class describes how to organize lyrics and music notes so it can be read by your band members. Other songs will have a similar organization, but with different lyrics and music notes. When you write your program for your band to play a song, you would call the object 'Yellow Submarine' so your band members have access to the lyrics and music notes.

In object-oriented programming, you still have to write out the lyrics and music notes of the song, but only once, and then any band can use the lyrics and music at any time. From now on, every other program can call the same object and play the song. And other songs will be organized in a similar manner, so one band can play any song without having to change your code very much.

OOP Most Popular

Object-oriented programming has become the dominant programming paradigm in today's software development. Most of the newer programming languages that have been developed over the past 10 to 20 years are object-oriented. However, this does not mean that the other paradigms have gone away, and procedural programming languages are still widely used.

Some languages combine elements of both paradigms. For example, the widely used language C++ was derived from the language C, which is a procedural language. Object-oriented components were added to C to become C++, which is therefore both a procedural and object-oriented language.

Lesson Summary

Different programming paradigms represent fundamentally different approaches to building solutions to specific types of problems. Two of the most important programming paradigms are procedural programming and object-oriented programming. Procedural programming uses a very detailed list of instructions to tell the computer what to do step-by-step. 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. Object-oriented programming has become the dominant programming paradigm in today's software development, but procedural programming languages are still widely used.

People are saying…

"This just saved me about $2,000 and 1 year of my life." — Student

"I learned in 20 minutes what it took 3 months to learn in class." — Student

See more testimonials

Did you like this?
Yes No

Thanks for your feedback!

What didn't you like?

What didn't you like?

Next Video
Create your Account

Sign up now for your account. Get unlimited access to 8,500 lessons in math, English, science, history, and more.

Meet Our Instructors

Meet all 53 of our instructors