The inverse attack of Scala and Clojure functional programming language

Source: Internet
Author: User

The world of programming is like a river, a variety of technology and ideas as a variety of internal and external home Kungfu in the history of the stage on the scene, each lead. Today, from C, C + + inherited from the Java as the representative of the command-style language is the most flourishing, disciples thousands. Over the years, these languages have occupied the top of the Tiobe programming language rankings, while many "declining" languages have faded out of sight in recent decades. In imperative language, with the popularity of object-oriented programming, the discussion of design pattern has always been a hot topic in OO Programmer group, and the related problems of design pattern have become the hard index of the interviewer selection candidate.

However, there is a gradual emergence of a statement, "Some design patterns are actually used to compensate for the lack of language itself," that is to say: most of the design patterns may not exist, as long as the design patterns into the language design, so that the language has enough expressiveness, So many patterns will no longer be needed or can be greatly simplified. Perhaps you are still skeptical about this statement. But a "declining aristocrat" has been reproduced in front of you, it is a functional programming language.

Functional programming language once disappeared in the lake, perhaps most people only in the ivory tower to appreciate their demeanor. Its "decline" is not without reason, such as early people on its performance of the question and so on. However, with the wind of the big data age, the heirs of the functional lineage once again stood on the top of the tide and left their footprints in the lakes and rivers.

Google's paper mapreduce:simplified Data processing on Large clusters indicates that The abstraction of the MapReduce programming model is inspired by the map and reduce primitives in functional languages such as Lisp.

Distributed real-time computing system Storm's core code was written in Clojure, and when "programmer" asked why Storm founder Nathan Marz chose Clojure, Nathan replied: "Clojure is the best language I've ever used." It allows me to easily use techniques such as immutability and functional programming to make my efficiency a big boost. Based on the dynamic nature of Lisp, I can always shape clojure into a state that fits the best abstraction. There would be no difference if there were no clojure,storm, but the process would be much more painful. "

The next generation of distributed computing systems spark not only chooses Scala in its implementation, it also provides the preferred programming language for Scala. From the API provided by the RDD, it is easy to see that this is a typical functional programming, which takes full advantage of the simplicity and immutability of functional programming.

......

In the age of big data, you are expected to have heard of the above deeds. With today's large-scale distributed computing power and unlimited level of expansion capabilities, the original functional programming in the performance of single-machine is no longer the most popular problem. In particular, the performance of functional languages such as Scala and Clojure is not the same on a modern high-performance JVM platform. What we value more is its concise declarative programming style and rich language expressiveness, and its emphasis on immutability and "No side effects" function also makes the program easier to write, thus further liberating the programmer's productivity, so that "yards farmers" can save more time to drink coffee, Do something more creative. This is one of the main reasons why the technical community is so vocal about adding lambda expression support to Java 8.

Returning to the topic of design patterns, Gof's design pattern is based on object-oriented programming, and it does guide the growth of a generation of OO programmers. However, once you learn more about the programming paradigm, you will find that the original OO pattern is no longer required in many other paradigm languages, especially in functional programming languages, where the focus is on functions that have first-class support, and no longer objects. With its declarative programming style and rich linguistic expressiveness, you can no longer replicate the design pattern in a boilerplate manner, with some built-in instructions and syntactic sugars that allow you to write code in a concise, refined, elegant way, as you would write a poem. In contrast to imperative-style languages, the amount of code in a functional language that solves the same problem can be reduced to half of the former, and sometimes even to an order of magnitude. So, in a functional language, we can replace the original design pattern in object-oriented programming with a more concise approach. In the practice of pure functional programming, pioneers have precipitated some patterns of functional programming, which are best practices in functional programming.

If you're a Java programmer, the Scala and Clojure functional programming model is prepared for you. This is a martial arts cheat code that focuses on the functional programming model using Scala and Clojure. Both Scala and Clojure are functional languages based on the JVM platform. The functional programming principles in Scala program, created by Scala designer Martin Odersky, became one of the most pass-through programming courses on the Coursera. Since 2012, at least 50,000 people have attended the course, and 10,000 of them have passed the course certification, as evidenced by the popularity of the program. The functional gene of Scala,clojure, a part of the object-oriented lineage, is more pure, and it comes from a pedigree of Lisp. Paul Graham, who has praise the productivity of Lisp in the hacker and painter, has no doubt about his status. The author Michael Bevilacqua-linn uses these two JVM languages to explain the functional programming pattern in contrast, the first half of which combines the object-oriented model, and enumerates some alternative schemes for object-oriented patterns in functional programming. The second half focuses on programming patterns that are unique in the functional programming world. By reading this book, you can learn all kinds of functional programming ideas and techniques for a smooth transition from the original Java imperative programming to functional programming to lay a solid foundation, so that the JVM to write a more lean program.

The inverse attack of Scala and Clojure functional programming language

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.