Programming Paradigm and language

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

This article is the "new thinking of programming" COP team invited to do a project to share the programming paradigm. The main is their own in reading, study, work on some of the summary, the ability is limited, hope can be explored together.

Why you should understand programming paradigms and languages
So far, there are about 2500 programming languages in the world, some of which are related to genealogy.



[Image upload ... (2)]
Language from the world view of thinking and influence of software design, different paradigms to look at the design of the angle is quite different, such as command paradigm language with state (variable) abstract The real world, object paradigm language to the object object of the real world, function paradigm language to calculate (function) abstract real time. The different viewing angle of the real problem fundamentally influences the way of thinking of software developers and the understanding of software design.
The generation and prevalence of programming languages have their own age backgrounds, for example,
Under the low efficiency of the early development of machine language, more efficient programming language is needed, and the structure design idea comes into being, which can be distinguished by the language of command paradigm, and the C language as the outstanding representative;
Subsequently, the high mortality rate of large-scale software development projects, let people rethink the software design principles and ideas, this time facing the object design ideas stand out, command paradigm language can not practice these new software design concepts, the emergence of new language is inevitable, this section of a large number of object paradigm language emerges, including C + +, The acceptance of the Java language is the most extensive;
Later, with the proliferation of multi-core CPUs and the emergence of distributed computing application scenarios, in order to save programmers from the complicated and concurrency-managed tar pits, language can provide a suitable abstraction mechanism to describe the concurrency scenarios, when the function paradigm and concurrency mode finally attract people's attention and become the darling of the spotlight. , in which Erlang and Golang language have the highest degree of attention;
Then, it is found that in some specific application areas, the common language can not be perfectly described in the abstract level of the problem domain, and for different problem domains, a large number of domain-specific languages are produced. Because DSLs are simpler, more abstract, more professional, and closer to natural languages than general-purpose languages, the development efficiency increases significantly. In addition, this approach fills the gap between professional programmers and business analysts, especially critical.

But as software becomes larger and more demanding, and changes become faster, a large number of languages, design patterns, and frameworks emerge to manage the rapid expansion of software complexity. In the face of these new knowledge, we often feel puzzled: 0 Why are there so many new languages, new design patterns, new frameworks? 1) How to quickly learn and master these new languages, design patterns and frameworks, are there more universal laws behind them? 2) How is the design pattern based on a language (such as Java,erlang) used for reference and applied to B language (e.g. C)?
From the perspective of abstract semantics, design patterns, frameworks, libraries are a kind of extension of language, said the harsh point, these are to make up for language defects patches. For example, for a dynamic type language, a type is used like a variable, and many of the creation design patterns are useless. For functional languages, functions are used like variables, and many behavioral design patterns are useless.
Through the deep learning programming paradigm and the language design, we can push through the complicated design pattern fog, understand the essence of software design and the thought and method of solving the problem from the origin of language, let us quickly grasp the context of language, and then improve our software design ability and sense of language, deepen understanding design pattern, the meaning of frame.

Differences in programming paradigms * *

The core value of the programming paradigm is to break through some of the limitations of the original programming approach, bringing new ideas and methods to further liberate the programmer's workforce. The Programming Paradigm Summary table is as follows:

[Image upload ... (4)]

The programming world view is that a program is an ordered list of action instructions, and its methodology is to use variables to store data and execute instructions with statements, whose design idea is structured design. Good at user-oriented, interactive, multi-event-driven, business logic complex applications.
Functional and logical languages specialize in applications based on mathematical logic, such as concurrency, artificial intelligence, symbolic processing, databases, compilers, and so on. The high-order function in functional programming is equal to the basic data type, so the code can be used for data, which is one of the reasons why the program is simple and powerful. The callback mechanism uses a functional style.
Although the object style is developed on the basis of imperative, the essence is to glue the relevant function with data, repack the label of the object again. Object is the basic module unit of object, and object is the simulation of concrete things and abstract concepts in reality, it is closer to human cognitive mode, programmers are more likely to be more willing to program in this way. The idea of program programming is to process-centric, top-down, and gradually refinement. Object style is the opposite, data-centric, bottom-up, progressive merging.
Concurrent programming is process-oriented (process-oriented), with task-centric modularity of the system.

Examples of programming Paradigms:
Policy mode
Python Object-style implementation

Quick Line

Erlang function Implementation qsort ([])--[];qsort ([h| T]), qsort ([LO | | Lo <-T, lo < H]) + + [h] + + qsort ([HI | | Hi <-T, hi >= H]).

Common features of programming languages

In the previous section, we looked at the language from a macro perspective, and summed up 5 major programming paradigms from 2500 different languages. So from the microscopic point of view of language, whether it can also be found in 2500 languages, common? The answer is yes.
There is a point of view: Software = data + algorithm. Data is described by data type, and the algorithm is described by control, so no matter how the language emerges, all languages are designed without 2 fundamentals: control flow and data type. And in order to improve its descriptive ability, it provides control abstraction and data abstraction. This is a big topic, this is not to say, the following map of the brain basically covers the language design of control flow, control abstraction, data types and data abstraction of the core issues and means of implementation.


Resources:

    1. "Colon class"
    2. "Programming language-the road to Practice", third edition

--eof--

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.