Tuesday, 10 July 2012

My first techie blog!!


Hi today il share with you some of the knowledge I have about the Procedural Languages,Functional Languages and Objects Oriented Programming.
We could have spent hours and hours learning about so many languages,their syntax and coding .And of course you would have heard of the abve mentioned words somewhere in your journey now,and in case you are not clear about the above mentioned terms r the differences between each of them ,then I think you can try you can spend a few minutes reading this post !

So what is procedural programming?? and what are the languages you think that exactly comes under that???I guess C is the language that most of them would have started with.How do we write a program in that?We put all the instructions together in a sequential order in a away to perform the function required..

Procedural programming
--->In that we specify the steps or the instructions to perform a task in a specific chronological order.
--->If you randomly remove a chunk of code from your program it is not gonna result in proper execution.You will end up in an errorenous result.
--->The language which is the mst close to machine language ,because the functional and the object oriented programs when compiled by the compiler will again become a set of instruction in a specific order.
--->In procedural,we write codes to get input from the user,so in different executions we may get different outputs based on the different input values.Now u may think why im mentioning such a lame point now!! But this is one of the contrasting point with the Functional languages.Read on.....and you will know.
--->Execution is done only in one specific order.Change of the sequence will either result in compilation error or errorenous results.
--->Importance is given to the logic used and this is contrasting to object oriented approach where importance is given to the Data.
--->Examples are C,PASCAL,FORTRAN,LOGO,BASIC
--->Though i specify C as a procedural language ,there is also a little coupling involved in it in the forms of functions,but then it is just in a smaller level and from a top crader point of view,it is scene as a procedural language.

Now Hope you got a gist of what procedural languages are.So now lets slowly move on to the
Functional Approach:
--->Smaller degree of coupling like we bind data,variables and logic.It helps us use a piece of code again and again.
--->This is mostly used in mathematical functions where one function is calls another function from anywhere else with no abstraction at all.
--->This has referential transparency.You will get the same output for every execution because the arguments get the value from the function.
--->Data abstraction is more inclined to functional languages because only the function call is what comes in the program and everythin else will be inbuilt.
Like f1(f2(f3(x),y),f1(x),f1(x))
--->It is a lazy approach cos the value is calculated only when it is executed.It is statically typed.
F(6+5) is not F(11) until the point of execution.--->Order of evaluation is usually defined.
--->Good fit for parallel execution,and it still gives the right answer.
--->And these functional approach is not very commonly used.Examples are Haskell,Lisp.
Now moving on to Object oriented approach.
The very second you here this I guess it is classes and objects which comes to your mind.Be clear with what they are...
Class is a template,a Model which binds the state and behavious together.
Eg-Consider a vehicle class with state as color,name,type,wheels etc and behavious as acceleration,brake,reverse etc..And object is an instance of class,as in an instance of vehicle lik bus car,van etc.They have difference in their features but hav the same attributes.so car and van etc can be objects to vehicle class.
--->Importance is given to the data organisation in oops where it is logic in procedural.
--->Variable name redundance is reduced with this cos we access the attributs with different Object names.
--->There is strong coupling because of the presence of classes between variables,data,logic and functions.
--->polymorphism is an effective technique and makes the language more flexible by letting us call the same function with different number of arguments.
--->Overriding is another cmmon feature in this where you can override the derived functions with the virtual keyword in the function declaration..I guess u understand,anyways il give a detailed post on oops soon.guess it will help,in case u dont get it.
--->High security,is achieved with the help of encapsulation using Private keyword.
I guess i have told the differences between them .Hope it helped....

- Sourcebits University
Cloud Computing

No comments:

Post a Comment