Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enterprise patterns with functional programming

Tags:

Is there any good source of (centralized) information about enterprise architecture patterns (a la Fowler's), maybe with examples and use cases and a fair amount of practical information? For example, I have seen many of the design patterns of GoF all shortly explained in some SO posts and other sites, as well as practical information related to them. I'm asking for an analogous resource from a more functional paradigm oriented to enterprise applications.

Thanks.

like image 523
ale64bit Avatar asked Jan 09 '15 01:01

ale64bit


People also ask

Can you use design patterns in functional programming?

In object-oriented development, we are all familiar with design patterns such as the Strategy pattern and Decorator pattern, and design principles such as SOLID. The functional programming community has design patterns and principles as well.

What is functional programming example?

Functional programming is based on mathematical functions. Some of the popular functional programming languages include: Lisp, Python, Erlang, Haskell, Clojure, etc. Pure Functional Languages − These types of functional languages support only the functional paradigms. For example − Haskell.

What are the applications of functional programming languages?

Functional programming languages are often preferred for academic purposes, rather than commercial software development. Nevertheless, several prominent functional languages like Clojure, Erlang, F#, Haskell, and Racket, are used for developing a variety of commercial and industrial applications.

What is functional programming architecture?

Fundamentally, a pure functional programming language should not retain state and is more like a math expression than a procedural program. This architecture works for compiler construction or, perhaps, for APIs.


1 Answers

I'm asking for an analogous resource from a more functional paradigm oriented to enterprise applications.

There's no resource that I'm aware of. Large scale enterprise use of modern FP is often < 10 years old, so resources tend to be in internet form. Also, a lot of people avoid the GoF as largely irrelevant to FP.

SO remains your best bet (here's an example: https://stackoverflow.com/a/3077912/83805 ). There's a market for an FP architectures book though, that's for sure.


Editorial

In my experience, almost all designs fall into the 'compiler' or 'interpreter' pattern, using a model of the data and functions on that data. That is, problem domains are represented as algebraic structures (objects as ADTs with functions over them), and software architectures are about mapping from one algebra to another. This is the "category theory" design pattern(!)

Our algebraic data types are the best way of capturing structures. Functions are the best way to transform these structures, or map them to new types of structures. And there's lots of research on writing compilers and interpreters that makes this stuff easy. You can implement most systems by writing a compiler (or interpreter). So learn to write compilers.

It's quite amazing how many things fall out as interpreters or compilers, when you start looking for these "categoric" software problems. Things like MVCs fall out as interpreters. A lot of business software (data munging) becomes parser+analysis+pretty printer -- i.e. a compiler. Maybe it is obvious that architectures (i.e. how to glue components) is really about algebras and categories.

Obviously this is about high level architectures. Lower level things, like how best to implement a logging systems, or how best to wire up expensive components, how to pass environments around, replay/rollback do have particular abstractions that you can reuse are a different problem. Often monoids/monads/applicatives or other computational notions captured as libraries.

Again though, we go to the algebraic view to find the structure that best captures the problem domain.

like image 150
Don Stewart Avatar answered Sep 30 '22 08:09

Don Stewart