Coast on Clojure(coast.swlkr.com) |
Coast on Clojure(coast.swlkr.com) |
Combining a Rails like framework that makes things easy with a language who's idioms prioritize simplicity seems like a great combination.
The best of both worlds, in my opinion, is a loosely coupled set of opinionated tools and libraries, but that also has a tool that provides a unifying interface into the "golden path" for using those together to provide some functionality.
I think that's what makes Phoenix and Elixir so nice to use. The primitives Phoenix uses aren't too far from the surface, and the default setup is fairly batteries included without ruling out future growth.
You're paying the tax at some point, but if that's at the start of the project it might be high enough to stop it in its tracks. A mature Rails or Django project require abstracting configuration later on in development which is a different sort of tax.
Convention over configuration absolutely has it's perils. I've unfortunately (fortunately?) hit this enough times with Clojure, I know the ecosystem well-enough I'd personally pick composition for a personal project. In a team project where composition makes collaboration difficult (generally a communication and experience problem) I'd probably choose another language with an opinionated framework.
Any good HTTP/JSON/Crawler examples or libraries ?
I haven’t worked on this one much lately, but I’m happy to answer any questions!
We have several production grade libraries and frameworks for serving webpages. Reitit(router), yada(http standards), bidi(router), aleph (netty wrapper), ring (jetty wrapper), pedestal (bundle of libraries), luminus (self described micro-framework), the list goes on, yet Clojure's biggest pain point is the lack of other production grade libraries for other/mundane things.
If the libraries do exist, they can barely cut a stable release (like 2.0.0-alpha24) or keep up with changes to prevent software rot.
For example, things like clj-stripe, Matchbox(firebase lib) Onyx(MapReduce lib), and Cortex(ML lib) are all out of date.
One thing I see a lot from companies using Clojure(script) is they fork open source projects, extend them for their needs, and never contribute back.
Clojurescript libraries in particular are extremely bad for this. For example, re-frame-firebase has suffered some serious bit rot lately, the core repo uses firebase sdk 5.7, and hasn't ever really been used in a production setting!
Anyways, not trying to call out these library maintainers because I do understand maintaining libraries is time consuming. I'm trying to call out companies taking from the community and not giving back.
That said, I don't really have any good use case for it right now, whether at work, or among my side projects.
The first project we built together with it was called magehash, and it was an app to monitor websites for Magecart attacks (code injection stealing credit card data).
That project ended up not working out, but I’m using a lot of the lessons I learned with Sean at my new project (https://www.june.so) which is ironically a Rails app and we keep in touch on Twitter regularly
Turns out it's really hard to beat the productivity of rails
Any reason why this should be used instead of cooking up ring / hickup / whatever ?
I would say if you’re not new to clojure, roll your own.
That said, you do need to actually use the repl and be repling all the time because the startup times suck and the stack traces are gigantic all the time. That's pretty much it for complaints. You would expect things that aren't apparent in 30 minutes looking at the language to come up after an entire year, but nothing so far.
Does it still do that? I remember "better error messages" being a supposedly-coming-soon thing for the couple years I was using it. I eventually got used to it but damn what a hostile experience. In retrospect I'm pretty surprised I stuck with it. For better or worse I don't have that same tolerance & resilience now.
[1] https://reagent-project.github.io/
If you care to share, i'd love to learn what you are building with it.
I have a bit of time now and I am diving in again and am more determined this time!
I got clojurescript going with react native, and having fun so far. If you need inspiration check out Rich Hickleys talks. He keeps me going through the hard times!
json encoder/decoder - https://github.com/janet-lang/json
Not aware of any HTML parsers/traverses (if that's what you mean with "Crawler") but interfacing with C libraries is easy so grab any C library you'd like for that task.
The libraries you mentioned are something I never needed, but I understand what you mean now.
My company is in the smarthome/IOT space and we use React(Native) + Clojure and ClojureScript for all our apps, dashboards, servers, etc.
This is almost it. A few more things I think one wants:
- Do most of the coupling and plumbing yourself, IoC is evil when applied to things that do too much.
- Control the application state - see above.
- Be free to substitute any major part, be able to compose them freely.
- Re-use and extracting libraries from past work to be convenient, robust and affect past / maintenance-mode projects positively too.
- Be able to defer extracting libraries and generalizing up to the time you actually need to.
- Decouple code organization from artifact deployment.
- Be absolutely free in how you design and write domain logic and information processing - this is the brain of an application.
- Be absolutely free in how you design and write the UI - this is the body of an application.
- Have the tooling/utilities around code that fit your workflows and business needs.
I've come to the conclusion that full-stack frameworks in the style of Rails/Laravel/Django get in the way of some of the above and don't provide enough to make the above possible by themselves. I think the answer is not "use this framework" or even "build this framework".
It starts with your business/domain needs and builds from there - custom and simple. It builds up slowly and steadily like a garden that reflects your team's personality. It takes a careful, comprehensive, holistic approach. There are angles from version control, to project management to deployment that are all incorporated.
Provides the “easy” for 95% of usecases and an “eject” button that unwraps everything and puts it under you control for the last 5%.
Yeah, with the arrival of clojure.spec, some error messages has indeed gotten easier to both read and parse (for humans and machines alike), although when you use Clojure JVM so still come across the odd huge Java stack-trace (or with ClojureScript, a pretty sizable JavaScript stack-trace).
That said, I’ve actually used Rails and Django in the past and written a small project in Clojure so I can try.
I actually really love Clojure and had really positive experiences wit Django though I’ve come to favor lighter frameworks like Starlette. Programming in Clojure is quite interesting because it’s functional programming so all the information you need to reason about the function is generally passed in as parameters. It made code comparatively easy to reason about simply by reading the code for the specific function. Clojure also has good support for REPL. I don’t have to do a lot of hunting around for “outside” code to understand what’s going on inside a function. This is the polar opposite of Java, especially when dealing with giant frameworks like Spring, where there is a lot of layers being combined just to do one thing. Coding in Java/Spring, Rails, and even Django can feel a lot like dealing with those nesting dolls.
Like the grandparent, I wish to do more with Clojure some day.
i guess i assumed that since this thread was about web frameworks that their large clojure code base was also a web application. though i see that isn't necessarily implied.
Rails chose idioms and conventions that prioritize speed at the cost of complexity. The “included batteries” are not the problem.
TLDR: He hated the Java part of Clojure
I spent a lot of time in jvm land though, a few years of nights and weekends, but I finally learned that it wasn’t for me.
I’m a C (or rust or llvm or what have you, wasm?) person, not a jvm person.
Again, this is just my preference. YMMYV
There are a few projects that try todo this like this one: https://github.com/mattn/golisp
But it seems abandoned.
I've done a runtime lisp, but it felt like programming a lisp isolated from everything that made Go, well, Go. I've done a simple lisp to generate Go AST to do codegen pre-1.18, but that's not a complete program.
I haven't found the place yet that feels quite like Clojure.
clojure still relies on the jvm though, for repl things.
sci and babashka were interesting, but at that point I had already moved on to janet