Programming Language Paradigms


Languages can generally be divided into a few basic types, though many languages support more than one programming style. This following list isn't all inclusive or as fine-grained as possible, but it brings out some of the basic design decisions behind languages



THE FOLLOWING ARE THE PARADIGMS TYPE
1.Procedural
The programming style you're probably used to, procedural languages execute a sequence of statements that lead to a result. In essence, a procedural language expresses the procedure to be followed to solve a problem. Procedural languages typically use many variables and have heavy use of loops and other elements of "state", which distinguishes them from functional programming languages. Functions in procedural languages may modify variables or have other side effects (e.g., printing out information) other than the value that the function returns.

2.Functional
Employing a programming style often contrasted with procedural programming, functional programs typically make little use of stored state, often eschewing loops in favor of recursive functions. The primary focus of functional programming is on the return values of functions, and side effects and other means storing state are strongly discouraged. For instance, in a pure functional language, if a function is called, it is expected that the function not modify any global variables or perform any output. It may, however, make recursive calls and change the parameters of those calls. Functional languages are often simpler syntactically and make it easier to work on abstract problems, but they can also be "further from the machine" in that their programming model makes it hard to understand exactly how the code is translated into machine language (which can be problematic for system programming).

3.Object-oriented
Object-oriented programming views the world as a collection of objects that have internal data and external means of accessing parts of that data. The goal of object-oriented programming is to think about the problem by dividing it into a collection of objects that provide services that can be used to solve a particular problem. One of the main tenets of object oriented programming is encapsulation -- that everything an object will need should be inside the object. Object-oriented programming also emphasizes reusability through inheritance and the ability to extend current implementations without having to change a great deal of code by using polymorphism.


4.Scripting
Scripting languages are often procedural and may contain elements of object-oriented languages, but they fall into their own category because they are typically not meant to be full-fledged programming languages with support for large system development. For instance, they may not have compile-time type checking or require variable declarations. Typically, scripting languages require little syntax to get started but make it very easy to make a mess.

5.Logic
Logic programming languages allow programmers to make declarative statements (possibly in first-order logic: "grass implies green" for example) and then allow the computer to reason about the consequences of those statements. In a sense, logic programming is not telling the computer how to do something, but placing constraints on what it should consider doing.
Previous
Next Post »