Object Oriented vs. Procedural Programming 1

There are essentially two types of programming styles in use.  One is Object Oriented Programming (think Visual) and the other is Procedural based programming.  Depending on which style you learn, the other looks alien or even unorganized.  Some languages have a combination of the two, while others sit on one side of the fence or the other.  And while you can make an attempt at Object Oriented programming in a Procedural language, it’s not the same.

Object Oriented Programming:

An example of OOP is Visual Studio.  You will design a form with controls on it, and depending on what actions the user takes, the controls will execute some code.  This is a really basic interpretation of how an OOP language works.  The thing that makes object-oriented languages run is the object (no doubt).

Objects can be buttons, list boxes, text boxes, classes, or anything really.  Their main distinction is that they have properties (or attributes) and methods which act on those properties (events).  If you’re using Windows, then you use Object Oriented programs every time you do anything.  Any window is an example of Object Oriented Programming.  This also applies to Linux and Mac OS, although they are created in a different language than Windows.

Procedural Programming:

An example of Procedural Programming is COBOL or Pascal.  Since the applications are ran on a server—with no windows per se, they don’t need to have events or objects.  The main difference between an Object Oriented Program and a Procedural Program is the procedural program will start at line 1, and essentially go through to the last line.  It may jump around, but it will always return to it’s jumping point and continue on.  When it reaches the last line, it will end.  You will have to run it again.  An Object Oriented program will continue running until you end it (clicking the “X” or “Exit” button).

If you learn to program in a procedural style, then the first time you run an OOP style program, it looks alien.  You can’t find the starting point, and you can’t follow the flow very easy.  Likewise, if you learn to program in Object Oriented Styles, the Procedural style will throw you.  You’re expecting the user to have to trigger the events, but they happen on their own.  You expect the program to run until you stop it, but it stops on it’s own.

Hybrid Programming Languages:

Some languages are what I would call Hybrids.  They can be either procedural or object oriented.  C++, Java, and Delphi (which is an OOP form of Pascal) are examples of these.  They are hybrids because you can create procedural versions of applications, or you can use a Visual Designer (or code by hand) and create OOP style programs (which require events).  They still look alien to procedural style programmers because they don’t start at line 1 and go to the end.  But they are not completely Object oriented either.

The point of this post is to introduce you to the different programming styles.  Each has a place in the world of computers.  And it’s good to learn both styles, so you can adapt to the requirements.  Also in some cases, you can adapt one style to use some of the characteristics of the other.  This makes you a well-rounded and more essential programmer.

Have a great day:)

Leave a comment

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

One thought on “Object Oriented vs. Procedural Programming