Programming languages in layman’s language


There is such a wide variety of programming languages that there is always confusion as to why there is such a profusion of languages. Different programming languages solve different classes of problems. Programming languages can be classified broadly into the following 4 classes.

Procedural Languages: In these languages one thinks in terms of the sequence of steps to solve the problem. It could be thought of solving the problem in 1st person and then substituting the “I” with “the program”. So for example in procedural language we could think

I will wake up.
I will brush my teeth
I will open fridge
I will take milk
I will warm milk

So in procedural languages actions are performed sequentially to achieve the desired end result.

Examples: FORTRAN, BASIC, Pascal, C

Object Oriented (OO) Languages: When a problem is solved using Object Oriented techniques we look at the world objectively. So we need to first identify the participants and functions performed by each of these participants. So the above situation would be viewed as

I, Fridge, Microwave – Participants

then we need look at what functions the above 3 will perform
I – wake up, brush
Fridge – Open door, close door
Microwave – Warm

Hence in OO languages the problem is solved as the interaction of functions between participating objects.Examples: C++, Java, Smalltalk, C#

Both procedural and OO languages are compiled languages and are also known as “Imperative Languages”. A useful analogy is to view compiled programs as mashed, pre-cooked food that can be easily assimilated by the digestive system or the raw hardware.

Dynamic Languages: Here these languages are either interpreted or converted to byte code. Interpreted languages are similar to raw & uncooked food which must be crunched, munched and digested on the fly. However these languages include in themselves many, many features that are commonly used. While the first two would just specify the method, dynamic languages include several specific features as functionalities. To use an analogy while in the above 2 programming language types one would set the time and the power level for each item to heat in a microwave, dynamic languages come with readymade buttons for those frequently used.

I – wake up, sleep, eat, drink, wash etc
Fridge – Cool, refrigerate, thaw, and freeze
Microwave – Heat popcorn, frozen food, meat etc

Since you get a lot of stuff for free and the program is interpreted on the fly Dynamic Languages take a lot more time

Examples: Perl, Python, Ruby

Functional languages: Here we think in terms of functions that are performed on items. They can be performed on any object.

For example the above problem would be viewed as the following main functions
E.g. Wake, sleep, warm, thaw, heat, cool, freeze.
We then take and apply the function ‘warm’ on the ‘milk’
Heat on ‘vegetables’  etc

In Functional Programming functions invoke other functions to accomplish a task. The problem is solved from the inside-out. In Functional languages like Lisp one starts with some core functions and build layers over it. For e.g. in a functional language we would express calorific energy as

metabolize (assimilate (digest (chew (food))))

Examples: Lisp, Clojure, Haskell, Erlang

Each language is best suited for only certain applications. So just like it is inappropriate to use pliers where an Allen wrench would suffice we need to know which language is most suitable. If we know what the class the problem is and the performance we want we can choose the appropriate language

Find me on Google+

Advertisements

5 thoughts on “Programming languages in layman’s language

  1. Pingback: The mind of a programmer | Giga thoughts …

  2. Pingback: How to program – Some essential tips | Giga thoughts …

  3. Pingback: Programming Zen and now – Some essential tips-2 | Giga thoughts …

  4. Pingback: Inswinger: yorkr swings into International T20s | Giga thoughts …

  5. Pingback: Inswinger: yorkr swings into International T20s - Use-R!Use-R!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s