Monday, May 10, 2010

Object oriented programming VS Procedural programming

Programming had many revolutions in it’s history. In the beginning it was something only for computer engineers. In order to program we need to turn on or off a lot of switches. And even after that hard work we cold only do some simple math equation. The first compilers and text editors made programming look like we know it.




Revolutions in computer programming are the product of crisis in computer industry. Â Hardware is always better and better and when people buy new computers they expect from it to do lot more then previous generations. That makes pressure on programmers to make better programs and that leads to crisis. Like the crisis which led to birth of object oriented programming.



Procedural programming

Procedural programming was born before 30-40 years but it is still popular. Many very popular programming languages like C, Visual Basic and Pascal are procedural programming languages. Many of them are popular because they are easy to learn and are easy way to come in programming world. Pascal and Visual Basic are representing this part of programming world.



First of all don’t think that you can program something only in object oriented languages or that there is something that is only possible to do in procedural programming languages. There is none problem that can not be solved in both object oriented and procedural languages. Example: Linux kernel is very complex collection of programmes and services and it’s done in c (procedural) and microsoft office is done in Visual C++. So even complex programs can be done in procedural languages.



Procedural languages are in many cases easier to learn and easier to use. For all of you who are now starting to dive in programming world i would recommend to use C or Pascal. C is a little bit harder to learn but i recommend it because it’s a good start point before you start to learn C++ which i heighley prefer. Pascal is also good and later you can start with Delphi, object oriented version of Pascal, but Pascal and Delphi tools are commercial and don’t have Linux versions.



As i already written above procedural languages are good as starting point and are maybe better for some smaller project but it is not a rule some small programs can be easily done also in object oriented.



Object oriented programming

The object oriented programming is a newest methodology in programming. In short words it has classes in which you can incorporate a lot of functions and variables that are common for some  part. They can have parents and children and by that share some of it’s properties.



Object oriented programming is much more complicated than procedural programming. But it has many good attributes: Â code is much more synoptic, that means that its easy to have many people working on the code without getting confused, it’s easier to change some part of the code without screwing anything. There is also one very important point in object oriented programming and that is software reuse. Classes are included in modules and modules can be added to new programs you write. So if you really want to be a serious programmer you need to learn some object oriented and that is C++.



You can start to learn C++ even if you are a beginner but you need some good literature plenty of time and good examples.