Welcome to F(rench | unctional) P(astries | rogramming)

Guillaume Hivert
May 25 · 5 min read

As you may know, I do like functional programming. Functional programming is my way to go. It’s how I build software, and how I like to do it. Because it’s so simple, and also so powerful. And because it reduces technical debts so much. But today I’m writing a lot of JavaScript. Oh please, don’t get me wrong. I’m writing functional JavaScript. Let me explain.

In a perfect world, where grass is green, sky is blue, birds are singing all day long, and whales are not dying because of plastics while Earth temperature is gently stagnating around 25° C in Paris during summer. In this perfect world, Lisp developers are everywhere. Everyone learn Lisp as first or second language, and make simple algorithms. Everyone consolidates knowledge, but continues to have a crush for this good ol’ parentheses language. And while everyone should be forced to learn Python or any other whitespace significant language (yes, I strongly dislike whitespace significance), all of them secretly dreams of writing Lisp once again. Obviously, whales are dying because of plastics. And in our actual world, a lot of people are writing JavaScript and don’t even know Lisp. What a shame.

I’m a Lisp developer. In a perfect world where everyone is seeking for Lisp developers, I could have found a job in Common Lisp as soon as I finished university. But it’s not what happened.

I wrote some Elm for two years. But I never could stop to watch the Lisp developers with envy. Just like a little child watching other children eating ice cream, but who don’t dare to ask their parent to get one too. Lisp was terribly attracting, but I’m unable to work on a side project outside of my job with a new language. I needed to test it for real, on a real project. And before doing something new with Lisp, there were summer vacation.

I always liked summer vacations. You have some free time. You can rest, think, and try new things. You can binge watch Battlestar Galactica, and remains hidden in the quiet atmosphere of your bedroom. Netflix and Chill, you know. During those summer vacations, I made a lot of JS. And when I say a lot, I mean a lot. Like 20 days out of 30. All day long. With all my new functional superpowers, I discovered a mainstream language made for me: designed around functions. OK, I know, it’s far from perfect. I didn’t have macros. I couldn’t expand the syntax. But it didn’t matter. I was able to build things more quickly than I ever could before, and I could use everything I wanted, without any limit. Never. Just like Lisp, I was the god for the JavaScript runtime running into my computer. And like all gods, I should assume my errors, but I also had all the powers. The language trust me to do things right. It was my turn to take my responsibilities. As an old man says: with great power comes great responsibilities.

The French Pastries officially project started in last October, when I was working for a big client (NDA, bla bla bla…). Pushing Clojure (or worst! Common Lisp) was complicated. All the company was running Node and JS or ReasonML, and I it was simpler for me to focus on JS. It was a simple language I could easily maintain. And Clojure, well… The JVM and I never really were friends… And I didn’t had time to learn all the Clojure specificities. The decision was taken! JS it will be. Let’s find a server. Oh, wait…

Is someone able to explain me why everything I found about JS and backend are whether Express.js or Express.js-like servers? I really dislike Express. It exposes the request and the response object anytime. I just feel bad about it. I like purity. I like functional programming. I really dislike having to write res.send(realResponse) to return a response! No no no! Why no one took inspiration from Clojure and the beautiful Ring and Compojure API?

This thoughts were turning in my head over and over since September, way before the mission started. Why no one was writing a cool server for Node.js? Why everyone was just satisfied with something so verbose? Maybe because of the Blup Paradox? I couldn’t understand why. Maybe it was because it’s impossible in JS? “Stop kidding me, let me one day and I will do something like this…”

That’s just what I did. Writing a Clojure inspired server. That was the beginning of the French Pastries (FP) stack. That was the first package written. MilleFeuille. A simple server promise oriented. Like Koa, but simpler. Like Ring and Compojure, but in JS. That was the first stone of the FP stack. A stack focused around functional JavaScript. Focused around simplicity and usability. Abstracting complex things for you.

That’s what I used for the client, and I never could write some much code so quickly. Because of the promise oriented approach and monad mindset of MilleFeuille the codebase grew quick, but with little technical debt. A complete refactoring of the code took me one day. So little code was expressing so much. No useless LoC, no useless imperative statement. Only functions, computations, and returns. The project was good, and go to production. French Pastries stack was mature enough to go with it.

Today at Wolfox, we’re using the FP stack and we continue to develop it over and over. We strongly believe in functional programming, and JavaScript is a decent language to get it implemented. Because functional programming means functional interfaces, but also functional mindset. We will build an entire micro-services stack in open-source, for everyone, to build the best software possible. Just keep an eye on it!

To conclude, I don’t regret the JavaScript choice, because it also guarantees a lot of people in the wild. Contrarily to Clojure or Common Lisp, I know I can find people writing JS without too much pain. I’m CTO and entrepreneur now, and unfortunately, I got other problems than code. I’m happy with JS, but I force myself or my Lead Tech to review all lines of code going into production. JS probably add a little overhead, but it’s worth the cost, because of the high level of productivity I can have using it. If you’re skeptical about it, just like I was before, try it. And if you have a bunch of Lisp developers around you, what are you waiting for creating your startup in Lisp? Maybe one day you will need all the complicated tools like static typing, linting, IDE, static analysis, etc. But when you’re focusing on boostrapping your company, just use what you love and the tool with the one you’re used to. You could always switch tool later.