What's the relationship between Leiningen, Compojure, Luminus and Ring?
Asked Answered
A

3

12

I'm starting my new learning phase of Clojure. I want to build a web application, but I don't know which one to use. I've searched for several hours online, and all the things I found kind of overlap each other and I'm a little bit confused by that.

I have experience in ASP.NET MVC and JavaEE, so if there's something to relate Clojure web programming with those experiences, I'm glad to hear about it.

What's the relationship between Leiningen, Compojure, Luminus and Ring?

Avelar answered 17/1, 2014 at 12:57 Comment(0)
I
12

Leiningen is a build tool. Something like Maven in Java world (in fact, it uses Maven under the hoods). You define dependencies and configurations in project.clj, and then run nice Leiningen commands to download dependencies, compile you code, run your application and much more.

Ring is a basic web framework. You can compare it to Servlets in JavaEE. It provides basic functionality for handling requests, but isn't very high level or full of features. In particular, it requires you to write route dispatching yourself.

And if you don't want to mess up with routing, just use Compojure. As it states on its GitHub page, "Compojure is a small routing library for Ring that allows web applications to be composed of small, independent parts". If you need comparison with Java worlds, I think Spring MVC quite close is analogue.

I haven't heard about Luminus before, but it seems like it's trying to replace Noir (which is deprecated now). Both Luminus and Noir are built on top of Ring and Compojure and further extend Compojure functionality.

Inadvisable answered 17/1, 2014 at 13:36 Comment(4)
Luminus isn't extending Compojure functionality.Rugged
@Chiron: I guess you mean that Luminus mostly ties other libraries together (e.g. lib-noir) rather than add new capabilities itself. If you mean something else, feel free to extend the answer.Inadvisable
Ring is in fact very flexible - so much so that all the other web tools are built on top of it! What it isn't is high-level, or full of features.Darlinedarling
@amalloy: I've just realized that I used "flexible" as synonym to "full of features" (i.e. flexible out of the box, as opposed to low-level, having only basic functionality), which may be misleading for other users. If you don't mind, I'm going to use your wording instead.Inadvisable
R
8

Leiningen is a build tool optimised for Clojure development. It interacts mainly with Maven repos. You can for example generate pom.xml file from your project.clj

Ring is low level API for web application development. For example, it uses maps data structures to wrap request and response. And of course, it providers handlers, middle wares and other important artifacts.

Compojure provides an elegant routing library. Most of time, it is used with Ring.

Luminus is a collection of many Clojure libraries to help you start developing web applications in Clojure.

Rugged answered 17/1, 2014 at 13:26 Comment(0)
C
6

The differences among those elements are already well answered so I will try to brief you a bit of my researching about Clojure alternatives for people with ASP.NET MVC backgrounds like myself. I suggest you to explore this couple

Caribou

As the own page says:

Caribou is a dynamic web application ecosystem for crafting production ready web inhabitants with minimal effort. Forged in the fire of daily requirements, Caribou is a collection of solutions to problems web developers face every day. The philosophy behind its development is to solve every problem we come across once, in a general way that can be reused over and over. Anything unnecessary or obstructive has been burned away from the wear of constant use.

My resume: a quick environment to model data structures in somehow "object oriented fashion" where you have models and data layer. You would find this more familiar coming from .NET as it provides lot of stuff ready to be used out of the box, even a web interface to play with the models.

Pedestal

Pedestal is a collection of interacting libraries that together create a pathway for developing a specific kind of application. It empowers developers to use Clojure to build internet applications requiring real-time collaboration and targeting multiple platforms. In short: Pedestal provides a better, cohesive way to build rich client web applications in Clojure. Clojurists looking for a standard way to build internet applications will love Pedestal. Rather than composing art out of found objects, they will now be able to mold a single, consistent form to match their vision.

My resume: a very functional approach to develop web apps, well designed and powerful but definitely not familiar or similar to ASP.NET, really worth a review

A bit out of topic just to mention Liberator for the sake of completion just in case you fancy to implement REST API's with Clojure.

Christenachristendom answered 18/1, 2014 at 2:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.