Mads Ravn, Antonis Polykratis, Martin Mancuska, David Farago, Edgar Rojas, and Adrian Javaloy.
Here is your price:
The challenge was to answer the question Why is functional programming becoming more and more important in C++?
Here are the answers. I will cite the answer of Adrian Javaloy in full length. From the remaining answers, I pick the most interesting parts. Here we are.
TheWinners
Adrian Javaloy
I think that functional programming has been underestimated from a long ago, mainly due to you could do the same thing in imperative programming and it would be quite faster.
But we are reaching a point where functional programming is not slow anymore (in fact, Clang uses a functional intermediate programming language to optimize C++ code) and, what is even more important, functional programming supplies some features that traditional paradigms lack. Those features, among others, are these:
- Offers a more mathematical view of point of programming, and allows you to care about the what to do and not the how to do it (giving you some high-level functionalities like folding). This is possible since functions are first-class objects and we can generalize everything even more.
- Since its functions don't have side-effects provides an easy way of automatically parallelize a program. This is a really strong reason, I've seen a lot of people already pointing out that poor thread management and data races are major problems nowadays (and even so, that threads are the nowadays goto, it's something that we should use without actually writing it).
- Since there aren't side effects code reusability is quite easy to perform.
- And last but not least, I find really interesting the possibilities that functional programming offer when we combine it with lazy evaluation. It's really awesome!
Those features may seem more from a language like Haskell rather than C++. But that's due to Haskell is almost pure functional and C++ is multiparadigm, even though we can not follow some of those rules in C++ since some time back people is encouraging us to follow these non-side effects programming style so is quite obvious that are becoming more and more important in C++ too. To realize it you just have to see some on the latest Cppcon conferences or even a 2011 John Carmack's blog entry!
Mads Ravn
I think it is because it is much more easy to reason about your code when programming functional. There is much less clutter in regards to side effects which you might not notice. The expressiveness of functional programming is much better where you state your intent much clearer.
Antonis Polykratis
- Because functional programming can help in verifying the correctness of multithreading and distributed programs, especially in a future where automated reasoning about software will be increasingly important
- Because in an era where more and more mathematical formulas are converting in code (machine learning era), functional programming can provide easiness on this.
- Because with functional programming you can leverage category theory as a framework for design patterns.
- Because c++ needs to expand its audience with new developers with the desire to work on new ways of thinking about code.
Martin Mancuska
- an effective approach for a new era of big data (dealing with them) and
machine learning
- safer programming paradigm (immutable data, not changing state)
- better performance (functional programming languages are better suited for parallelism)
- sure, you are saying to what to do with the data, not how to work with them
David Farago
- the functional programming paradigm can be extended further in C++, which helps to write and compose algorithms on a high-level and to get maintainable, fast, and concurrent code
- it is the basis for ranges, which further improves functional programming as well as the STL (which already has a strong functional flair)
- it is the paradigm for template metaprogramming, which yields truly generic code and can offload some of the computational efforts onto the compiler.
Edgar Rojas
About the Functional Programming, I like two (2) main characteristics:
- The result is a “truly” modular and well-structured software, and
- native” concurrency.
So, if you connect both ideas:
- Functional Programming is becoming more and more important in C++ because we are adding “native” concurrency and obtaining “truly” modular and well-structured software by using a powerful and “appreciated" programming language as is C++.
How to get your book
I will send to all of you an E-Mail at Sunday including the coupon code for the voucher. Here is the link to the book: https://www.manning.com/books/functional-programming-in-cplusplus. If you have any issues using the coupon code, please let me known. Ivan will help you. The coupon codes are valid until May, the 17th 2017.
Weiterlesen...