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.
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 the point of programming, and allows you to care about what to do and not 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 purely functional and C++ is multiparadigm, even though we can not follow some of those rules in C++ since some time back people are encouraging us to follow these non-side effects programming style so is quite obvious that is becoming more and more important in C++ too. To realize it you just have to see some of the latest Cppcon conferences or even a 2011 John Carmack's blog entry!
I think it is because it is much easier 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.
- 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.
- an effective approach for a new era of big data (dealing with them) and
- safer programming paradigm (immutable data, not changing state)
- better performance (functional programming languages are better suited for parallelism)
- sure, you are saying what to do with the data, not how to work with them
- 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.
About 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 all of you an E-Mail on 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, 17th 2017.
Thanks a lot to my Patreon Supporters: Matt Braun, Roman Postanciuc, Tobias Zindl, G Prvulovic, Reinhold Dröge, Abernitzke, Frank Grimm, Sakib, Broeserl, António Pina, Sergey Agafyin, Андрей Бурмистров, Jake, GS, Lawton Shoemake, Animus24, Jozo Leko, John Breland, Venkat Nandam, Jose Francisco, Douglas Tinkham, Kuchlong Kuchlong, Robert Blanch, Truels Wissneth, Kris Kafka, Mario Luoni, Friedrich Huber, lennonli, Pramod Tikare Muralidhara, Peter Ware, Daniel Hufschläger, Alessandro Pezzato, Bob Perry, Satish Vangipuram, Andi Ireland, Richard Ohnemus, Michael Dunsky, Leo Goodstadt, John Wiederhirn, Yacob Cohen-Arazi, Florian Tischler, Robin Furness, Michael Young, Holger Detering, Bernd Mühlhaus, Matthieu Bolt, Stephen Kelley, Kyle Dean, Tusar Palauri, Dmitry Farberov, Juan Dent, George Liao, Daniel Ceperley, Jon T Hess, Stephen Totten, Wolfgang Fütterer, Matthias Grün, Phillip Diekmann, Ben Atakora, Ann Shatoff, and Dominik Vošček.
Thanks, in particular, to Jon Hess, Lakshman, Christian Wittenhorst, Sherhy Pyton, Dendi Suhubdy, Sudhakar Belagurusamy, Richard Sargeant, Rusty Fleming, John Nebel, Mipko, Alicja Kaminska, and Slavko Radman.
My special thanks to Embarcadero
My special thanks to PVS-Studio
My special thanks to Tipi.build
I'm happy to give online seminars or face-to-face seminars worldwide. Please call me if you have any questions.
Standard Seminars (English/German)
Here is a compilation of my standard seminars. These seminars are only meant to give you a first orientation.
- C++ - The Core Language
- C++ - The Standard Library
- C++ - Compact
- C++11 and C++14
- Concurrency with Modern C++
- Design Pattern and Architectural Pattern with C++
- Embedded Programming with Modern C++
- Generic Programming (Templates) with C++
- Clean Code with Modern C++
- Phone: +49 7472 917441
- Mobil:: +49 176 5506 5086
- German Seminar Page: www.ModernesCpp.de
- Mentoring Page: www.ModernesCpp.org