Object Oriented vs. Procedural Programming Paradigm

Smartherd
29 Mar 202203:40

Summary

TLDRThis lesson introduces programming paradigms, focusing on the differences between Object-Oriented Programming (OOP) and Procedural Programming. It explains that OOP divides programs into objects, supports inheritance, and emphasizes data security with access specifiers, making it more secure. Procedural Programming, on the other hand, divides programs into functions, lacks inheritance, and has limited data protection. The lesson also touches on how languages like C++, Java, and Python fit into these paradigms, with C++ being a hybrid language. The next lesson promises a detailed comparison between C and C++.

Takeaways

  • πŸ“š Programming paradigms classify programming languages based on their features.
  • πŸ” Two common paradigms are Object-Oriented Programming (OOP) and Procedural Programming.
  • 🧩 OOP divides programs into objects, while Procedural Programming divides programs into functions.
  • πŸ”„ OOP supports code reuse through inheritance, unlike Procedural Programming, which lacks this feature.
  • βž• OOP supports function overloading, whereas Procedural Programming does not.
  • πŸ” OOP includes access specifiers for better data security, which are absent in Procedural Programming.
  • πŸ”’ In OOP, data is prioritized and can be protected, making it more secure than in Procedural Programming.
  • πŸ’» Languages like C++, Java, Python, and C# follow the OOP paradigm.
  • πŸ’Ό Procedural Programming includes languages like C, FORTRAN, Pascal, and BASIC.
  • 🌐 C++ is a hybrid language, supporting both OOP and Procedural paradigms, bridging the gap between the two.

Q & A

  • What are programming paradigms?

    -Programming paradigms are a way to classify programming languages based on their features and approaches to problem-solving.

  • What is the primary difference between Object-Oriented Programming (OOP) and Procedural Programming?

    -The primary difference is that in OOP, the program is divided into objects, while in procedural programming, it is divided into functions.

  • Why is code reusability higher in OOP compared to procedural programming?

    -Code reusability is higher in OOP because it supports inheritance, allowing for the maximum extent of code reuse, whereas procedural programming lacks this feature.

  • Does OOP support function overloading, and if so, what does it mean?

    -Yes, OOP supports function overloading, which means that multiple functions can have the same name but different parameters.

  • What are access specifiers in OOP, and why are they important?

    -Access specifiers in OOP are keywords like public, private, and protected that determine the accessibility of class members. They are important because they enhance security by allowing selective exposure of data to the outside world.

  • How does the OOP paradigm handle data security differently from procedural programming?

    -In OOP, data security is managed through access specifiers, allowing for data hiding, whereas procedural programming lacks this mechanism, making data less secure.

  • What is the significance of data in OOP compared to procedural programming?

    -In OOP, data is treated with higher priority than functions due to the use of access specifiers and data hiding, making data more important. In procedural programming, data is less prioritized as there is no proper data hiding mechanism.

  • Which programming languages are examples of OOP paradigm?

    -Examples of OOP paradigm languages include C++, Java, Python, and C#.

  • Which programming languages are examples of procedural programming paradigm?

    -Examples of procedural programming paradigm languages include C, FORTRAN, Pascal, and BASIC.

  • Why is C++ referred to as a hybrid language?

    -C++ is referred to as a hybrid language because it supports both OOP and procedural programming paradigms.

  • What will be the focus of the next lesson according to the script?

    -The next lesson will explore in detail the differences between C and C++ languages.

Outlines

00:00

πŸ“š Introduction to Programming Paradigms

This paragraph introduces the concept of programming paradigms, which are ways to classify programming languages based on their features. It mentions that many paradigms exist in the programming world, with Object-Oriented Programming (OOP) and Procedural Programming being two of the most common. The paragraph sets the stage for a discussion on the differences between these two paradigms.

πŸ”„ Object-Oriented vs Procedural Programming

The focus here is on comparing Object-Oriented Programming (OOP) and Procedural Programming. OOP divides programs into objects, while Procedural Programming divides them into functions. The paragraph highlights the significant differences, such as OOP supporting inheritance and code reuse, whereas Procedural Programming lacks these features, limiting code reusability.

πŸ”’ Security and Access Specifiers

This paragraph discusses how OOP supports access specifiers, which enhance security by allowing control over data visibility. In contrast, Procedural Programming does not support access specifiers, leading to less secure data handling since all data is public by default. This difference emphasizes how OOP prioritizes data protection, making it more secure.

βš™οΈ Functionality and Data Handling

In OOP, data is considered more important than functions, owing to the presence of access specifiers and data hiding mechanisms. However, Procedural Programming focuses more on functions because it lacks these features, making it necessary to manage functions to achieve program objectives. This distinction marks a limitation of Procedural Programming compared to OOP.

πŸ“œ Examples of Programming Languages

The paragraph lists examples of languages that fall under each paradigm. It mentions that languages like C++, Java, Python, and C# are classified under OOP, while languages like C, FORTRAN, Pascal, and BASIC are categorized as Procedural Programming languages. Notably, C++ supports both paradigms, making it a hybrid language.

πŸ€” Hybrid Nature of C++ and Conclusion

The final paragraph acknowledges that C++ supports both OOP and Procedural paradigms, making it a hybrid language. This dual nature might cause confusion, given the differences between the two paradigms. The paragraph concludes by suggesting that the next lesson will delve deeper into the distinctions between the C and C++ languages to provide more clarity.

Mindmap

Keywords

πŸ’‘Programming Paradigms

Programming paradigms refer to the broad categories of programming languages based on their features and approaches to problem-solving. They dictate how programmers structure their code and interact with the programming language. In the video, paradigms are used to classify languages into different groups, with a focus on Object-Oriented Programming and Procedural Programming, highlighting how they differ in their approach to organizing and executing code.

πŸ’‘Object-Oriented Programming (OOP)

OOP is a programming paradigm that uses 'objects' to design applications and programs. It is centered around the concept of 'objects', which can contain data in the form of fields (often known as attributes or properties) and code, in the form of procedures (often known as methods). The video explains that in OOP, the program is divided into objects, which supports features like inheritance, function overloading, and access specifiers, making it more secure and efficient for code reuse.

πŸ’‘Procedural Programming

Procedural programming is a paradigm that focuses on writing procedures or functions that perform operations on data. It is a structured programming paradigm that emphasizes the use of procedures to solve problems. The video contrasts procedural programming with OOP by noting that it divides programs into functions rather than objects, lacks support for inheritance, and does not support function overloading or access specifiers, which can limit code reusability and data security.

πŸ’‘Inheritance

Inheritance is a fundamental concept in OOP that allows a class to inherit properties and methods from another class. This promotes code reusability and reduces redundancy. The video mentions that OOP supports inheritance, which enables the creation of new classes based on existing ones, thus maximizing code reuse, whereas procedural programming does not support this feature.

πŸ’‘Function Overloading

Function overloading is a feature in OOP that allows multiple functions to have the same name but different parameters. This provides flexibility in function naming and usage. The video points out that OOP supports function overloading, which is not supported in procedural programming, thus limiting the flexibility in naming and using functions.

πŸ’‘Access Specifiers

Access specifiers in OOP are keywords that determine the accessibility of class members, such as private, protected, and public. They control the visibility and accessibility of the data within a class. The video explains that OOP supports access specifiers, which enhances security by allowing the programmer to hide data and expose only necessary parts of the class to the outside world, a feature absent in procedural programming.

πŸ’‘Data Hiding

Data hiding is the practice of restricting direct access to some of an object's components, which is a mechanism to keep the internal state of an object hidden from the outside. The video emphasizes that OOP supports data hiding through access specifiers, making it a more secure paradigm as it allows for the protection of data by not exposing it unnecessarily.

πŸ’‘C++

C++ is a programming language that supports both OOP and procedural paradigms, making it a hybrid language. The video notes that C++ can be used for both paradigms, which is why it's often referred to as a hybrid language. This dual capability can be confusing, and the video promises to explore the differences between C and C++ in more detail in a subsequent lesson.

πŸ’‘Hybrid Language

A hybrid language is one that supports multiple programming paradigms, allowing programmers to use different styles and techniques within the same language. The video uses C++ as an example of a hybrid language, highlighting its ability to support both OOP and procedural programming, which provides programmers with flexibility in how they approach problem-solving.

πŸ’‘C

C is a procedural programming language that was developed as a system programming language for writing operating systems and applications that require a high level of control over hardware. The video mentions C as an example of a procedural language, noting that it does not support OOP features like inheritance and access specifiers, which are key aspects of the OOP paradigm.

πŸ’‘Code Reusability

Code reusability is the ability to use existing code in new or existing programs without having to rewrite it. It is a measure of how easily and efficiently code can be reused. The video discusses how OOP, with its support for inheritance, enhances code reusability, whereas procedural programming, lacking these features, has limited code reusability.

Highlights

Programming paradigms are a way to classify programming languages based on their features.

Two of the most common programming paradigms are Object-Oriented Programming (OOP) and Procedural Programming.

In OOP, the program is divided into small parts known as objects.

In Procedural Programming, the program is divided into small parts called functions.

OOP paradigm supports inheritance, allowing for maximum code reusability.

Procedural programming lacks inheritance and has limited code reusability.

Function overloading is supported in the OOP paradigm but not in Procedural Programming.

OOP paradigm supports access specifiers, enhancing security by controlling data exposure.

Procedural programming does not support access specifiers, resulting in less secure data handling.

In OOP, data is treated with high priority, making it more important than functions.

Procedural programming focuses on functions, with all data being public by default.

Languages like C++, Java, Python, C# fall under the OOP paradigm.

Languages such as C, FORTRAN, Pascal, and BASIC are classified under the Procedural paradigm.

C++ is a Hybrid language, supporting both OOP and Procedural paradigms.

The next lesson will explore the differences between C and C++ languages in detail.

Transcripts

play00:04

In this lesson, we will explore what are programming paradigms and henceforth differentiate between

play00:11

Object-oriented programming and Procedural programming.

play00:16

So let's start with exploring what are programming paradigms.

play00:20

Well, programming paradigms are a way to classify programming languages based on their features.

play00:29

And there are a lot of paradigms that exist in the world of programming.

play00:33

Two of the most common programming paradigms are: 1 - Object-Oriented Programming 2 - Procedural

play00:40

Programming So let us explore the differences between them.

play00:47

On the left, we have object-oriented programming paradigm.

play00:50

For simplicity, I will call it as OOP paradigm and on the right, we have procedural programming

play00:57

paradigm.

play01:00

In the case of OOP paradigm, the program is divided into small parts known as objects.

play01:08

But on the right, the program is divided into small parts called functions.

play01:14

And this is one of the significant difference between these two paradigms.

play01:19

Just because OOP paradigm supports inheritance, we can reuse the code to the maximum extent.

play01:27

But on the other hand, since we don’t have objects and classes, support for inheritance

play01:32

is absent.

play01:34

So there is limited code reusability.

play01:38

Features like Function overloading is supported in OOP paradigm.

play01:43

But on the other side, it is not supported.

play01:47

In the OOP paradigm, access specifiers are supported.

play01:51

While on the other hand they are not supported in procedural programming.

play01:58

Due to that, OOP paradigm is more secure.

play02:02

Because we can use access specifiers to decide which data should be hidden and which data

play02:08

should be exposed to the outside world.

play02:12

But in procedural paradigm, due to the lack of access specifiers, data is less secured.

play02:18

There is no proper way to hide data.

play02:22

This makes data to be treated on top priority in OOP paradigm.

play02:27

So data becomes more important than functions.

play02:31

But in procedural programming, since we don’t have access specifiers and no proper data

play02:36

hiding mechanism, so we are only left with dealing with functions.

play02:42

So by default, all data becomes public and we need to manage only functions to achieve

play02:47

our objective.

play02:49

Which is quite a limitation.

play02:50

Isn't it?

play02:51

And the languages such as C++, Java, Python, C# falls under the OOP paradigm.

play03:00

And languages such as C++, FORTRAN, Pascal, C, basic comes under procedural paradigm.

play03:10

So here, you can note that C++ supports both OOP paradigm as well as Procedural Paradigm.

play03:16

That’s why C++ is often referred to as a Hybrid language.

play03:24

This might confuse you right now, looking at the differences between these two paradigms.

play03:29

So for more clarity in the next lesson, we will explore in detail the difference between

play03:34

C and C++ language.

play03:37

See you there.

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
ProgrammingOOPProceduralCodingSoftware DevelopmentProgramming ParadigmsInheritanceData SecurityHybrid LanguagesCode Reusability