DEV Community

Finn Wright
Finn Wright

Posted on

Functional programming for the backend

Hi DEV Community! I've been using Next.js for the "frontend" of my websites, and I've been loving the speed and simplicity with the functional nature of react. I'm now looking to bring that experience to the backend. How do you bring functional programming to the backend? Do you use a functional programming language? Just an object oriented language with some fancy libraries? I'm stuck choosing what to learn for my next project.

Top comments (12)

Collapse
 
mk0y8 profile image
Marko Jakic

Take a look at my writings here. I use plain JavaScript, but with some custom and Ramda functions. Composition is the key in my opinion.

Collapse
 
wdhowe profile image
wdhowe

Have a look at Clojure (clojure.org/).

Once you learn that, you could even branch back out to ClojureScript (clojurescript.org/) on the front end.

Collapse
 
fifn2 profile image
Finn Wright

Do you feel like Clojure web servers are mature enough?

Collapse
 
wdhowe profile image
wdhowe

I'm not too familiar with ClojureScript (yet), but Clojure has a nice list of success stories: clojure.org/community/success_stories

The development team I joined recently is using Clojure as a processing backend and it has been very solid/stable.

Collapse
 
perty profile image
Per Lundholm

We are using F# for the backend and Elm in the frontend.

The F# syntax is not always nice and sometimes we resort to using OO style just to make things easier. But it has static typing. The support in VS code is below par, IMHO, so the money on Rider is worth it.

Collapse
 
lgtout profile image
jabiodun

Take a look Kotlin and the ArrowKt library.

Collapse
 
fifn2 profile image
Finn Wright

Interesting. I will.

Collapse
 
lgtout profile image
jabiodun • Edited

Cool. The nice thing about Kotlin is that it's a hybrid functional + object-oriented language. I like this because I can always switch to OO when I get stuck in FP. I come from OO originally, so my skill in FP sometimes hits its limit. The most important aspect of Kotlin's hybridity is that functions are first-class citizens. Also, check out the very active Kotlin FP channel #arrow on kotlinlang.slack.com.

Collapse
 
fifn2 profile image
Finn Wright

Do you think Ruby is a good functional programming language?

Collapse
 
mucorolle profile image
Muco Rolle Tresor

If you like Ruby, take a look at Elixir

Collapse
 
mohaalak profile image
Mohammad Hadi Aliakbar

checkout fp-ts library, if you want to use functional programming in backend using typescript.
and also you can checkout the F#, you can have all tools in .net but in a functional first language

Collapse
 
mucorolle profile image
Muco Rolle Tresor

I'm in the same boat as you, but I decide to go on Elixir as it supports FP from the ground up