[trident "0.1.0"]
Because I had to call it something
Trident is my personal experiment in creating a highly-abstracted web application framework for use with Datomic Cloud.
We all know that the Clojure community prefers libraries over frameworks. The difference between a library and a framework isn't well-defined, but I think of it this way: a framework is just a library with a much larger scope than the average library. This has several implications:
The latter point is why we don't like frameworks. The effort required to patch a framework to accommodate the functionality you want is often higher than the effort to put all the libraries together yourself. The downside is that now you have to put all the libraries together yourself, which can be tedious.
It'd be better if we could have the leverage promised by frameworks without sacrificing the flexibility of libraries. I believe this is entirely achievable; it just requires careful design. Armin Ronacher wrote a great article about this kind of design here. Essentially, the key is to provide a layered API. The top layer of the API should be as high-level as possible. When you hit a use case that the framework doesn't handle, it should be easy to drop down to a lower API layer and provide whatever customization you need.
To summarize: although there are good reasons for using libraries instead of frameworks, that doesn't mean we shouldn't put effort into developing good frameworks. High-quality frameworks can boost the productivity of experienced Clojure developers and increase Clojure adoption.
Furthermore, Datomic (especially with ions) provides a big opportunity to do more abstraction. I think we could use a framework that's built specifically for Datomic, and I'm hoping for Trident to become this framework.
I wouldn't necessarily recommend actually using this code since it's at a very
early stage, but I'd love to hear about it if you try. If you're interested in
developing applications on top of Datomic, you might enjoy at least reading some
of the code. There isn't any documentation yet (I'm working on that now), but
trident.web/init!
is a good starting point. There is also a small
website which I have written with Trident.
This article describes several features which I have since moved into Trident, including:
In addition, I've organized Trident in a way that makes it highly modular
without sacrificing convenience. All the code is stored in a single src
folder, and individual projects (along with their dependencies) are defined in
the trident.edn
file. jobryant.build
is used to take slices of the codebase and
package them into jars, along with a couple other tasks.
Rather than trying to cover a bunch of use cases up front, I'm taking the approach of:
Currently the only application I've built with Trident is FlexBudget, so Trident is still pretty contrived for that use case.
Future work includes:
Distributed under the EPL v2.0
Copyright © 2019 Jacob O'Bryant.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close