Book Image

Hands-On Functional Programming in Rust

By : Andrew Johnson
Book Image

Hands-On Functional Programming in Rust

By: Andrew Johnson

Overview of this book

Functional programming allows developers to divide programs into smaller, reusable components that ease the creation, testing, and maintenance of software as a whole. Combined with the power of Rust, you can develop robust and scalable applications that fulfill modern day software requirements. This book will help you discover all the Rust features that can be used to build software in a functional way. We begin with a brief comparison of the functional and object-oriented approach to different problems and patterns. We then quickly look at the patterns of control flow, data the abstractions of these unique to functional programming. The next part covers how to create functional apps in Rust; mutability and ownership, which are exclusive to Rust, are also discussed. Pure functions are examined next and you'll master closures, their various types, and currying. We also look at implementing concurrency through functional design principles and metaprogramming using macros. Finally, we look at best practices for debugging and optimization. By the end of the book, you will be familiar with the functional approach of programming and will be able to use these techniques on a daily basis.
Table of Contents (12 chapters)

Summary

In this chapter, we outlined the steps taken to gather project requirements, architect a solution, and then implement the completed deliverable. We focused on how this process can be clarified using functional thinking.

When gathering program requirements, the required data, input, and output should be clarified. When translating requirements into a code plan, creating a dependency graph as an intermediary step can help simplify complex designs. When testing, functions become great units to cover. By comparison, lines and lines of imperative code are almost impossible to test.

We will continue to develop this software project throughout the book. This first simulation deliverable will accompany the project proposal and will hopefully help our firm be selected for the contract. In the next chapter, you will receive feedback from the developers and meet your competitor.

...