Principles of Programming Languages
Principles of Programming Languages:
Although there exist many programming languages, the differences among them are insignificant compared to the differences among natural languages. The common aspects shared among different programming languages may include:
Programming concepts and paradigms
Millions of programming languages have been invented, and several thousands of them are actually in use. Compared to natural languages that developed and evolved independently, programming languages are far more similar to each other. This is because different programming languages share the same mathematical foundation (e.g., Boolean algebra, logic);
Although there exist many programming languages, the differences among them are insignificant compared to the differences among natural languages. The common aspects shared among different programming languages may include:
- programming paradigms that define how computation is expressed;
- the main features of programming languages and their impact on the performance of programs written in the languages;
- a brief review of the history and development of programming languages;
- the lexical, syntactic, and semantic structures of programming languages, data and data types, program processing and preprocessing, and the life cycles of program development.
Programming concepts and paradigms
Millions of programming languages have been invented, and several thousands of them are actually in use. Compared to natural languages that developed and evolved independently, programming languages are far more similar to each other. This is because different programming languages share the same mathematical foundation (e.g., Boolean algebra, logic);
- they provide similar functionality (e.g., arithmetic, logic operations, and text processing);
- they are based on the same kind of hardware and instruction sets;
- they have common design goals: find languages that make it simple for humans to use and efficient for hardware to execute;
- designers of programming languages share their design experiences.
Some programming languages, however, are more similar to each other, while other programming languages are more different from each other. Based on their similarities or the paradigms, programming languages can be divided into different classes. In programming language’s definition, paradigm is a set of basic principles, concepts, and methods for how a computation or algorithm is expressed. The major paradigms we will study in this text are imperative, object-oriented, functional, and logic paradigms.
The imperative, also called the procedural, programming paradigm expresses computation by fully- specified and fully-controlled manipulation of named data in a stepwise fashion. In other words, data or values are initially stored in variables (memory locations), taken out of (read from) memory, manipulated in ALU (arithmetic logic unit), and then stored back in the same or different variables (memory locations). Finally, the values of variables are sent to the I/O devices as output. The foundation of imperative languages is the stored program concept–based computer hardware organization and architecture (von Neumann machine). Typical imperative programming languages include all assembly languages and earlier high-level languages like FORTRAN, Algol, Ada, Pascal, and C.
The object-oriented programming paradigm is basically the same as the imperative paradigm, except that related variables and operations on variables are organized into classes of objects. The access privileges of variables and methods (operations) in objects can be defined to reduce (simplify) the interaction among objects. Objects are considered the main building blocks of programs, which support the language features like inheritance, class hierarchy, and polymorphism. Typical object-oriented programming languages include: Smalltalk, C++, Java, and C#.
The functional, also called the applicative, programming paradigm expresses computation in terms of mathematical functions. Since we express computation in mathematical functions in many of the mathematics courses, functional programming is supposed to be easy to understand and simple to use. However, since functional programming is very different from imperative or object-oriented programming, and most programmers first get used to writing programs in imperative or object-oriented paradigms, it becomes difficult to switch to functional programming. The main difference is that there is no concept of memory locations in functional programming languages.
Each function will take a number of values as input (parameters) and produce a single return value (output of the function). The return value cannot be stored for later use. It has to be used either as the final output or immediately as the parameter value of another function. Functional programming is about defining functions and organizing the return values of one or more functions as the parameters of another function. Functional programming languages are mainly based on the lambda calculus. Typical functional programming languages include ML, SML, and Lisp/Scheme.
The logic, also called the declarative, programming paradigm expresses computation in terms of logic predicates. A logic program is a set of facts, rules, and questions. The execution process of a logic program is to compare a question to each fact and rule in the given fact and rule-base. If the question finds a match, we receive ayes answer to the question. Otherwise, we receive a no answer to the question. Logic programming is about finding facts, defining rules based on the facts, and writing questions to express the problems we wish to solve. Prolog is the only significant logic programming language.
The imperative, also called the procedural, programming paradigm expresses computation by fully- specified and fully-controlled manipulation of named data in a stepwise fashion. In other words, data or values are initially stored in variables (memory locations), taken out of (read from) memory, manipulated in ALU (arithmetic logic unit), and then stored back in the same or different variables (memory locations). Finally, the values of variables are sent to the I/O devices as output. The foundation of imperative languages is the stored program concept–based computer hardware organization and architecture (von Neumann machine). Typical imperative programming languages include all assembly languages and earlier high-level languages like FORTRAN, Algol, Ada, Pascal, and C.
The object-oriented programming paradigm is basically the same as the imperative paradigm, except that related variables and operations on variables are organized into classes of objects. The access privileges of variables and methods (operations) in objects can be defined to reduce (simplify) the interaction among objects. Objects are considered the main building blocks of programs, which support the language features like inheritance, class hierarchy, and polymorphism. Typical object-oriented programming languages include: Smalltalk, C++, Java, and C#.
The functional, also called the applicative, programming paradigm expresses computation in terms of mathematical functions. Since we express computation in mathematical functions in many of the mathematics courses, functional programming is supposed to be easy to understand and simple to use. However, since functional programming is very different from imperative or object-oriented programming, and most programmers first get used to writing programs in imperative or object-oriented paradigms, it becomes difficult to switch to functional programming. The main difference is that there is no concept of memory locations in functional programming languages.
Each function will take a number of values as input (parameters) and produce a single return value (output of the function). The return value cannot be stored for later use. It has to be used either as the final output or immediately as the parameter value of another function. Functional programming is about defining functions and organizing the return values of one or more functions as the parameters of another function. Functional programming languages are mainly based on the lambda calculus. Typical functional programming languages include ML, SML, and Lisp/Scheme.
The logic, also called the declarative, programming paradigm expresses computation in terms of logic predicates. A logic program is a set of facts, rules, and questions. The execution process of a logic program is to compare a question to each fact and rule in the given fact and rule-base. If the question finds a match, we receive ayes answer to the question. Otherwise, we receive a no answer to the question. Logic programming is about finding facts, defining rules based on the facts, and writing questions to express the problems we wish to solve. Prolog is the only significant logic programming language.
Need More Information then Download the material!
© Copyright Protected.