1.3.1 function paradigm

Source: Internet
Author: User

1.3.1 function paradigm

 

Functional programming is a programming paradigm that defines the concepts we can use when thinking about a problem, but it cannot precisely specify how to express these concepts in programming languages. Therefore, many function languages emphasize different functional styles and features.

We can use a more familiar paradigm, Object-Oriented Programming (OOP) to compare. In the object-oriented style, we think about the problem as an object. Every object-oriented language has an object concept, but the details vary by language. For example, C ++ has multiple inheritance and JavaScript has prototypes ). In addition, you can also use the object-oriented style in non-object-oriented languages, such as C. Although this is uncomfortable, it will still enjoy some benefits.

Multiple Programming paradigms do not conflict. C # language is mainly object-oriented, but some functional functions are also available in version 3.0, so we can directly use the techniques from the function style. On the contrary, F # It is mainly a function language, but it fully supports. net object model. The advantage of the combination paradigm is that we can choose the most suitable solution to the problem.

Even if you are not planning to use the function language, learning the function paradigm is worthwhile. By learning the function style, you can get a more convenient concept to think about and solve daily programming problems. Interestingly, many standard object-oriented models describe how to write code for functional concepts in the object-oriented style.

Now let's look at the benefits of functional programming. We will first understand the Declarative Programming style, which provides a richer vocabulary to describe our intent.

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.