Harish's World - neither here nor there...

  • home
  • publications
  • about
  • gallery
  • guestbook
  • contact me
Home

Types of Programming

harish — Tue, 06/20/2006 - 10:40

There are many programming languages. Some common and some many would not even have heard of. It's not just the syntax of the programs that make a language different, but the style of programming in that language is what makes it different. A typical example of this is C and C++. Both follow almost the same syntax. But the style of programming in both varies.

Each programming language has its own style. This is what got me into thinking the pros and cons of different programming styles. There are a lot of books that provide you in detail about this topic. Hence I don't wish to go into the technicalities of this, but rather would like to give you my views on it.

Let me first start with my favorite style, which I have been following almost from the time I learnt of it - Structured Programming. As far as I know this style of programming evolved to improve the understandability of programs. As the name suggests, the programs follow a structured flow. By understandability I mean, the flow of the program can be easily understood. Strictly speaking, this style can be followed in every programming language, except of course machine code. If you don't believe me, I still follow structured approach when I code even in Java. The Essence of this style which I follow is to have a single flow through the program. Every point in the program must have only one entry point and one exit point. This way following a code is very easy, and can help greatly in understanding and debugging the code.

Then of course there is Object Oriented Programming style. This considers the whole world as objects and relations between them. This style helps in simulation of real life situations easily and is also easy to comprehend.

Then there is the Logic Programming. This basically divides the known problem data into a set of facts and rules, and the problem into a set of queries. The answers to the queries are based on applying different set of rules to the given facts. If I am not mistaken this is used extensively in AI applications, where it is important to make decisions based on earlier known and collected data.

Oh.... How could I forget? I should have started with this one first. But it is never too late to introduce Unstructured Programming - a style where nothing is followed. I love this type. It's most commonly used in assembly language. But I have also done it in Basic, and also C. I am currently trying to program in this style using Java Wink.... These are the kind of programs that really test on how good you are at understanding code. If someone can understand unstructured programs easily, then I am sure they can understand any other type of program. These are the kind of programs one should write for the fun of it. To enjoy pure ancient programming, if I can call it that.

Last but not the least (at least the last style I know of) Functional Programming. I started with my favorite and also will end with another favorite of mine. Though I know very little of it, I have enjoyed very bit of what I have learnt and known of it. Here everything is a function, including your function arguments (this is in pure functional programming language). The power of functional programming is in the power of recursion. The way a problem can be divided into sub problems of the same type. I don't think I am qualified enough to speak about its power. I would just say it is beautiful.

There are many people who think one style of programming is better than the other. This notion is completely wrong. You must always think of the old saying - 'use horses for the courses'. What might be the best choice for one problem may be the worst for another. Hence while programming, the paradigm that is used must be chosen carefully. (But I guess unstructured programming can be used for any problem, as your compiler any way converts your code into object code, which has no structure).

  • Techno Rant

But C

Vikram (not verified) — Sat, 12/02/2006 - 23:36

But even in C Language also "Everyting is Function". So I think there must be some addidtional criteria to classify a language as functional.

Obviously not

Harish (not verified) — Sat, 12/02/2006 - 18:14

C is obviously not a functional programming language. LISP is an example of functional programming

Functional Programming

Vikram (not verified) — Sat, 12/02/2006 - 17:49

Is C a functional Programming Language? You have written "In a Functional programming language everything is function"?

"Bad" programmer?!

Rajesh (not verified) — Tue, 06/20/2006 - 14:11

Definately not! I am sorry if I even implied it.. I was under the impression that the meaning would be obivous: mere mortals (me included) aren't blessed with enough powers to see through Hari's extreme logic and monosyllabic function/variable names.. Laughing out loud

Tut Tut

Harish (not verified) — Tue, 06/20/2006 - 12:36

Didnt know i was such a bad programmer Sad

Couldnt resist posting...

Rajesh (not verified) — Tue, 06/20/2006 - 12:06

Hehe.. but I pity the poor souls who will read/maintain your UNSTRUCURED code! Your "structured" code itself should have been enough of perdition for a mortal's lifetime .. Laughing out loud

Blog

  • Time Pass
  • Techno Rant

Projects

  • Comex

Blogs I Track

  • Rajesh's C Vault
  • Venu's Online Diary
  • Apurv's Blog
  • Subba's Blog

Powered by Drupal, an open source content management system
  • home
  • publications
  • about
  • gallery
  • guestbook
  • contact me

Copyright © 2009 Harish D. All Rights Reserved.