The difference between procedural and object-oriented programming


Object-oriented programming is a programming language model organized around objects rather than actions and data rather than logic. The first step in OOP is to identify all the objects you want to manipulate and how they relate to each other, an exercise often known as data modeling. Once you have identified an object, you generalize it as a class of objects and define the kind of data it contains and any logic sequences that can manipulate it. Each distinct logic sequence is known as a method. A real instance of a class is called an object or an instance of a class.

The focus of procedural programming is to break down a programming task into a collection of data structures and subroutines, whereas in object oriented programming it is to break down a programming task into objects. Either method can be valid for accomplishing a specific programming task.

Procedural programming is used on lower levels of operating system (OS) (kernel, drivers, modules), and higher levels of OS and additional applications (tools) are here to give us advantages of object programming.

Appearance of complex object code, compared to procedural code, is much easier to read and memorize and it is easy to be inherited to create class inside class. Also, object-oriented programming easily discerns between data and program procedures.

Because OOP uses polymorphism it is easier to use the same functions/methods in different environments. Two classes that inherit one base class can have a method which both subclasses override in their own way. For example, if we have a base class Animal with method speak(), and two subclasses Dog and Pig which override it with bark() and oink() representatively, when we call an object instance method speak(), it will call the method bark() if the object is a dog, and method oink() if the object is a pig.(This is a typical and classic example found in Deitel Book). This will happen without using any conditional functions as we would have to do in procedural programming languages. This is very useful if we are working within complex systems and in multi-developer environments.


要查看或添加评论,请登录

Jad Matta的更多文章

  • Space Structure of our universe

    Space Structure of our universe

    ?There are two possibilities for the universe in the far future: 1.It could keep expanding forever.

  • WHY STUDENTS FAIL TO UNDERSTAND RECURSION

    WHY STUDENTS FAIL TO UNDERSTAND RECURSION

    A recursive function has the following general form (it is simply a specification of the general function we have seen…

  • A Statement About CS students

    A Statement About CS students

    Computer Science is becoming a trend and a major that attracts most of the students. Unfortunately, most of the…

  • Why C developers need to write code in C++.

    Why C developers need to write code in C++.

    As a software engineering approach C++ scales much more than C. I will provide several instances about this issue.

    5 条评论
  • Why Unix not Written in C++???!!!

    Why Unix not Written in C++???!!!

    C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the…

  • My Priorities

    My Priorities

    I have many priorities in my life with which I must deal each and every day. Not only do I choose to be a model student…

  • Freedom

    Freedom

    What is freedom? Is it an absolute right? We are born to become free. Freedom is defined from different aspects ,and…

  • True or False

    True or False

    1. Each of us is made up of 7 octillion atoms (7 followed 27 zeros) that are mostly empty space.

  • Why Math is Important!!!!

    Why Math is Important!!!!

    In today's world, we are bombarded with data that must be absorbed, sorted, organized, and used to make decisions. The…

  • Why C never dies

    Why C never dies

    One of the most popular systems programming language was C. It was written in 1974 by Dennis Ritchie.

社区洞察

其他会员也浏览了