Functional Design and Architecture (Second Edition)

Hello, my name is Alexander Granin, and this is the supporting page of my book
Functional Design and Architecture (Second Edition) by Manning Publications.

It is a fundamental book about Software Design in Haskell. The main idea of this book is to provide a comprehensive source of knowledge, and a complete methodology for building real-world applications in Haskell.

This is the Second Edition of the book. Consider scrolling down to the info about the First Edition.

The book is very practical. Application architectures, best practices, design patterns, and approaches, — all the information you need to achieve a simple, maintainable, testable code with low complexity and low risks. By reading this book, you’ll learn many useful techniques: from the requirement analysis to the implementation of particular subsystems such as SQL and NoSQL databases, multithreading, and logging. You’ll learn about design principles, application layers, functional interfaces, Inversion of Control, and Dependency Injection in Haskell.

It will be useful for software engineers who want to improve their software design skills with a strong relation to many advanced Haskell concepts.

The book requires a certain level of Haskell knowledge, up to intermediate.

The book covers a big gap in the Haskell ecosystem: the lack of resources for high-level application design. It’s also important that the ideas from the book were used in real production with great success. The book offers my own methodology — Functional Declarative Design, with Hierarchical Free Monads as a core technology. Using this methodology, I created several real-world frameworks, and they are driving a successful business in several companies.

Topics

  • Functional architectures
  • Functional design patterns and functional idioms
  • Accidental and essential complexity of FP programs
  • Design principles (SOLID, Low coupling / High cohesion; KISS etc.)
  • Architecture modeling, requirements analysis, subsystems design from FP point of view
  • Embedded and external DSLs in domain modeling (as a part of Domain-Driven Design)
  • Monads as subsystems with effects
  • Free monads as functional interfaces
  • Other types of functional interfaces
  • Inversion of Control in FP (using Free monadic eDSLs)
  • Applicability of mainstream techniques and approaches such as UML
  • Interaction with impure subsystems
  • Command-line applications and backend applications
  • Type-level programming
  • Various testing approaches including property-based, functional, unit, integration etc.
  • Approaches to build functional real-world concurrent application frameworks

There are several real-world projects based on the ideas from the book:

  • Juspay’s EulerHS framework (Haskell). A full-fledged framework for simple building web backends in Haskell. Provides own philosophy of layering, testing, and application architecture. The older brother of Hydra. Supports SQL DBs (MySQL, Postgres, SQLite), KVDBs (Redis), logging, multithreading, automatic regression testing, and more.
  • Juspay’s Presto framework (PureScript). Framework for building mobile apps using a handy eDSL.
  • Juspay’s Presto.Backend framework (PureScript). Framework for web backends.

The book is project-based. Actually, 2-projects-based.

  • Andromeda. A SCADA-like application and simulator for starship control. The first 5 chapters of the book describe the architecture and design of this project.
  • Hydra framework (Haskell). A full-fledged Free Monadic framework to build web services and console applications in Haskell. Supports various SQL DBs, KV DBs, logging, state, multithreading, etc. It also provides several demo applications and testing facilities. Hydra has 3 different engines based on Final Tagless, Hierarchical Free Monads, and Hierarchical Church Free Monads to provide a common basis for comparison of these approaches.

My articles about Hierarchical Free Monads:

I’m also giving talks on this topic.

Functional Design and Architecture (First Edition)

The first edition of the book was initially published on LeanPub. It has its own paper version, which is a rarity now:

There are two videos demonstrating it:
* video 1
* video 2

I don’t ship paper copies around the world anymore because of Russian customs (read this for explanations), but if you’re in Russia, you can contact me, and I can sell you a copy.

The economics behind the writing of the first edition (Twitter thread)

Acknowledgments for the First Edition

I’m very thankful to all the community and people who gave light to this project.

  • My wife 🙂
  • Manning Publications: editors, correctors, managers, and other people related to the project. They did a lot of work over the first five chapters of the book.
  • Reviewers and readers who made a lot of suggestions on how to improve the book.
  • All my Patrons and supporters:
    • Imran Settuba
    • Vasiliy Yorkin
    • Andrei Dziahel
    • Ivan Zemlyachenko
    • Yuriy Syrovetskiy
    • Pavel Dmytriiev
    • Anatolii Prylutskyi
    • Alessandro Pezzato
    • Олег Дмитриенко
    • Sergey Kintsel
    • Mikhail Gaidamaka
    • Tim
    • Vladimir Krivopalov
    • James Bartholomew
    • Fabian
    • Steven Paul Leiva
    • Mikhail Shustov
    • eb31b2cmikqbvcq8
    • Simon Bosse
    • Alexey Lebedeff
    • Vimal Kumar
    • Gabriele Lana
    • Adil
    • ekim boran danişger
    • Eduardo Moritz Cavalcanti
    • Andrei Orlov
    • Artur Yushchenko
    • SleepingCat
    • Anton Selyanin
    • Reynaldo Cordero
    • Alexander Kucherenko
    • Ashutosh Das
    • Dorzhi Tarbaev
    • Igal Tabachnik
    • Maxim Yaskevich
    • Ilia Rodionov
    • Angel Vanegas
    • Evgeny Lyutikov
    • Vadim Sotnikov
    • Sergey Homa
    • Allan Lukwago
    • Hécate
    • James Fielder
    • C++ User Group, Russia
    • Yaroslav Voloshchuk
    • Bogicevic Sasa
    • Vasily Gorev
    • Victor Savkov
    • Julian Wilke
    • Robert Gubin
    • Артем Миклушов
    • Olaf
    • Yuriy Pitometsu
    • Eugen Wissner
    • Tyler Weir
    • Grammarly
    • Jon Fast
    • Henry Laxen
    • Sandy Maguire
    • John Walker
    • erc
    • pluton
    • Evgeny Pogrebnyak
    • Donald Johnson
    • Mathew Fournier
    • Aleksey Sazonov
    • Alex Morgun
    • Nikita Puzankov
    • Christopher Miller
    • Innocent Ndubuisi-Obi Jr
    • Florian Pieper
    • Ivan Tester
    • Andrey Shinkevich
    • Daniel Gräber
    • Eugene Tulushev
    • Jonathan Thaler
    • Dmitriy Zakomirnyi
    • Swanand Kriyaban
    • Andrii Sergiienko
    • Sean
    • rohit
    • Imre Gulyas
    • Enzo Luis Strongoli
    • Ian
    • Martin Frické
    • John Man
    • Martin Allard
    • Mefire Omar
    • Matt Braun
    • Patryk Zieliński
    • Simon Shine
    • Cezar Halmagean
    • Anand Haridas
    • Brian Lane
    • Vitalii Skakun
    • Rui Morais
    • Francesco Zanini
    • Samael
    • Wojtek Malinowski
    • Nikola Marić
    • Jiri Hoogland
    • Derrick Beining
    • Martín Valdés de León
    • AJ Chambeaud