Some new feelings about programming after learning functional programming

Source: Internet
Author: User
I recently started to learn functional programming, and I plan to go deep into it to master the idea of functional programming. Take a look at the modern magic school's programming paradigm. In the future, most technical things will be organized into topics, chapters, and published in schools, while blogs will return to a more relaxed and casual state. Most of our programmers use imperative programming, because the programming taught by the school is imperative, what C, Java, and so on (of course they can also use functional programming)

I recently started to learn functional programming, and I plan to go deep into it to master the idea of functional programming. Take a look at the modern magic school's programming paradigm. In the future, most technical things will be organized into topics, chapters, and published in schools, while blogs will return to a more relaxed and casual state.

Most of our programmers use imperative programming, because the programming taught by the school is imperative, what C, Java, and so on (of course they can also use functional programming ). Functional programming and imperative programming are not a hierarchical concept. Theoretically, the theoretical basis of functional programming is Lambda calculus, and the directive programming is based on the Turing machine. From the programmer's point of view, functional programming does not support value assignment. a function execution only returns one value without any side effects. Therefore, a function is a large expression.

I will not go into functional programming here. For more information, see the topic mentioned above.

1. what is programming?

Programming is actually a process that abstracts things in the real world and is implemented by computer languages. The core steps include understanding, abstraction, and implementation.

Different understandings lead to completely different abstract results. different abstract results provide different understandings. Finally, based on understanding and abstraction, the completion time is determined by the specific language. however, to fully understand the results, the first two steps are required.

It is a bit like "what is a house, real estate design, and building a house" in the building ".

2. what are the development processes of programming?

According to my understanding, the history of Program Design is roughly divided into several major stages:

  1. The preliminary stage of computer program design is mainly the original mode such as tape and memory.
  2. In the early stage of computer language, the main language is assembly language, and the main content is "data storage + instruction set ";
  3. Extensive industrial computer language design stage; mainly for large-scale application of C language, at this time, the C language is more human-friendly. In addition, the operating system, compiler, and database software have begun to develop. The main content is "program = algorithm + data structure ". At this time, the main application of computer software design is the process-oriented design concept.
  4. Advanced development of computer language. The emergence of some object-oriented languages. It is mainly reflected in the emergence of C ++. The main content is "application = object + Communication. Even many languages begin with the design philosophy of "everything is an object. The object-oriented language was strongly promoted at this stage. Due to the complexity of C ++, Java's appearance reduces complexity and makes full use of the object-oriented features. The object-oriented design has been widely promoted and applied, especially in enterprise-level application development.
  5. Various languages are frequently used in various stages of prosperity. Various design languages such as WEB-oriented, functional language, concurrent-oriented language, and programming language of terminal devices are not easy to comment on at this stage.
3. What are the problems solved by the programming process?
  1. Assembly language:It solves the interaction between CPU instruction sets and storage systems and provides "programmable" capabilities.
  2. For languages with long names:Provides a solution to small-area problems. if there is not much code for a system, the system will be divided into multiple processes (multiple functions + various data structures) through a process-oriented approach for system design. It provides system design problems at the initial scale.
  3. Object-oriented language:When the process is oriented towards complex systems and complex world. How to "better understand and abstract" programming problems becomes more important. The object-oriented language features "encapsulation, inheritance, and polymorphism", allowing program analysis and design to accommodate a larger programming range and system scale, it also makes it very important for programmers to better understand and abstract.
  4. For ** language:WEB-oriented, highly concurrent, functional, and terminal-oriented languages are constantly improved based on existing programming languages and derived from the development of specific problems in specific fields;
4. what is the importance of object-oriented programming?

We all know that the three features of object-oriented are encapsulation, inheritance, and Polymorphism. However, I personally think that "encapsulation" is the core feature of object-oriented.

The main reason is that "encapsulation" allows a person to understand a wider range of systems, and enables us to "better understand and abstract" the world we see. Previously, when a teacher mentioned object-oriented, he mentioned "indirect". I think it can also be considered an upgraded version of "encapsulation. The object-oriented thinking brings "maintainability, scalability, and comprehensibility" and other things that allow us to grow more efficiently and horizontally.

5 .? Programming is to control complexity

Slow!

Although object-oriented has so many advantages, both C ++ and Java are widely used. However, simply pursuing maintainability ignores one point: programming is to control complexity. Do you still remember the "data storage + instruction set" and "program = algorithm + data structure" in the initial stage of programming development? Functional programming languages can make your programming more pure and more direct to the nature of the problem. (What are the advantages of Functional Programming?)

6. Summary

Process-oriented, object-oriented, and functional programming are all programming paradigms, that is, programming methods. The specific programming language is a tool.

The purpose of programming is to solve specific problems, rather than comparing the advantages and disadvantages of tools and methods. For example, if you want to cut a tree, you can cut it down with an ax, and you can also cut it off with a saw blade. it is of little significance to compare the advantages and disadvantages of an ax and a saw blade, horizontal cutting does not have much to do with oblique saw. Our goal is wood, which is the essential purpose of programming.

Of course, I recommend that you master several more tools and learn more methods. For example, if you only use PHP (ax) and command-based programming (cutting), you can only use an ax to cut down any tree you see. If you understand Python (saw) and functional programming (saw), the efficiency of some trees will be much higher.

A less rigorous metaphor is for reference only.

Address of this article: http://www.nowamagic.net/librarys/veda/detail/2497,welcome.

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.