Controlling complexity is one of the biggest challenges a developer faces. Functional programming helps tremendously with this and thus becomes more and more popular, even in originally imperative and object oriented languages like C++. This course will help you increase your productivity by teaching how to write functional C++ code that is easy to understand, test and reuse.
After mastering the basic building blocks of functional programming, you will learn how to think functionally and solve everyday programming problems in an elegant way. Every provided coding exercises comes with an exemplary solution.
At the end of this course you will be able to use the functional approach to write application code that is extraordinarily robust and pleasant to work with.
And as a bonus, all the concepts you have learned will not only help you when using C++, but are applicable to other programming languages too and will expand your horizon regarding programming in general.
You will learn the differences to imperative programming and why they matter.
You will see how even at the most basic level, your code can be improved immediately and how this renders some types of bugs impossible. Additionally you will be introduced to FunctionalPlus.
You will learn about the semantics of type annotations and why they are very useful.
This lecture will highlight different benefits following from purely functional code.
We will dive into a specific programming challenge and get a feel for concise code by writing in a functional style.
You will learn to create and use anonymous functions and how to capture objects by value and by reference.
This time we will develop a very expressive and elegant solution to the task of finding the longest edge of a polygon.
You will see how something done with very good intentions can actually have a negative value.
We will see if we can do even better than our previous solutions to the challenges and also solve something new.
These two key concepts of functional programming will make our code even more concise and clear.
You will learn how chained data transformation can be expressed in a nice and readable way.
We will develop an example illustrating the similarities of functional programming and querying a database.
We will check out how we can glue functions together in an even more concise way.
We will develop two small command line tools and extract a useful reusable higher-order function from our code.
You will learn how to think functionally from the start when confronted with bigger, real-life programming problems.
You will see one of the advantages of higher-order functions and pureness in action.
Once you know them, you will recognize them almost everywhere.
You will see how different error handling strategies arise and learn about their particular pros and cons.
Functors - what they are are and how this concept helps us on our quest for good code.
In case you heard that monads are complicated, forget about it. You will not only see how they develop naturally, you will even learn how to implement one on your own.
You will see how easy it is to refactor functional code, and how you can efficiently mix it with object orientated parts, even in an existing legacy code base.
Writing unit tests for pure functions is great.
You will see how performance bottlenecks can be identified.
Modern applications often have to handle many requests simultaneously or need to scale to multiple CPUs to increase performance. You will learn how to manage these demands in a straightforward way.
If you have the feeling that some classical object oriented design patterns are unnecessary convoluted, you are right. You will utilize your new functional programming skills to make some of them vanish into thin air.
Functional programming seems to have a bright future in the C++ community. You will learn about available libraries and how your new skills are universal in regards to them.
Finally we will have a look at how the C++ standard might change in the future and how C++ will provide more and more functional tools out of the box.
Tobias Hermann is using functional programming in C++ on a daily basis in professional and private projects. He is the main developer of FunctionalPlus, a publicly available C++ library facilitating functional programming in C++. He currently works in the computer vision industry where he develops high performance image recognition software in C++. His experience in teaching the functional programming paradigm face to face and in articles enables him to help you develop the skills needed to become productive with this approach.
Other interests of him include deep learning, game development and different programming languages like Python, Haskell and Elm.