Those libraries are good, but lacking when compared to the facilities that exist in frameworks in other languages. Compare bouncer to wtforms, for example; they both have similar validation capabilities, but wtforms gives you a ton of help generating HTML.
Migratus works fine, but with sqlalchemy+alembic or django or rails you can get automatically generated migrations, and full orm abstractions for your database. Sure, it's two conceptually separate concerns that are "coupled" gasp together, but maybe if I always want both of those things it's a net gain if the glue code is written and maintained by someone else.
Perhaps Luke is an architecture genius and has some way of addressing this without compromising the community's strong preference for small, single-purpose libraries. But in the more likely case, either some more comprehensive solutions need to appear, or we all just need to be OK with the fact of clojure bring a suboptimal choice for straightforward CRUD apps -- that is, 99% of web apps out there.
I think that Clojure libraries are still maturing, but also there's a difference in the workflow in a lot of cases.
For example, I predominantly use Reagent on the front-end, and HTML generation in a validation library wouldn't be of much help there. I do however appreciate the fact that bouncer cross-compiles and I can use common validation logic on the client and the server.
I've not really found ORM to be necessary in Clojure myself. I really like the HTML templating approach extended to SQL that Yesql introduced and HugSQL builds upon. My workflow for migrations is to use lein migratus create migration-name, write the migraitons, then run lein run migrate. Perhaps there could be a watcher that runs migrations automatically as they change, but I haven't really found it to be a huge burden so far.
The nice part I found is that I can run migrations and generate queries all without having to restart the app. I often run migrations, write the queries then reload them in the repl and keep going. Most of the time I don't even have any code in the db namespace since all the query functions are generated automatically.
So, when I write a CRUD app, I generally only have to write the compojure-api endpoints on the server. Perhaps it's the types of apps I personally work on, but I don't find this workflow suboptimal to anything else I've tried.
There's an argument to be made that the equivalent Clojure just has you writing the migrations directly in SQL and working with schema-less maps in your application code and is therefore equivalent.
But the Django model definitions are used to build so much more.
Forms can be autogenerated from them, for validation and rendering
The admin dashboard is wholly built on them (you might argue you could do this with Postgres, too, but NOBODY HAS IN ALL THESE YEARS. It's just too much of a pain.).
Third-party libraries for Django make creative use of them all the time. For instance, django-rest-framework uses the models to basically do all the server-side work that you just described.
Auth can be basically built-in, because the auth contrib modules have access to these features and can make a few tables of their own.
I just don't believe this is something that can be waved away as equivalent to SQL plus some helpers. Migratus and HugSQL do their jobs well, but they're simply not on the same level in terms of ease-of-use and rapid development, which I find strange because the latter is definitely something Clojure developers tend to value.
Right, I prefer keeping migrations as plain SQL and as I mentioned earlier I really don't see value in using the ORM approach in Clojure. I really think that the migrations scenario is more or less equivalent.
The django-rest-framework looks similar to sweet-liberty, but I agree that this approach hasn't really caught on in Clojure world.
Personally, I've just never found this to be a big burden. It usually takes minutes to write some queries and put them behind a Swagger service using compojure-api. However, when I write my own SQL, I can do exactly what I want, using something like django-rest-framework, or sweet-liberty means that I have to work within the scope of its design.
My experience is that it can often get frustrating when you want to do something conceptually simple, but that doesn't mesh well with the the design of the framework.
That said, I certainly don't see any harm in having something like that available for people who like that sort of stuff. It just doesn't sound like Arachne aims to solve that problem either.
5
u/adambard Apr 18 '16
Those libraries are good, but lacking when compared to the facilities that exist in frameworks in other languages. Compare bouncer to wtforms, for example; they both have similar validation capabilities, but wtforms gives you a ton of help generating HTML.
Migratus works fine, but with sqlalchemy+alembic or django or rails you can get automatically generated migrations, and full orm abstractions for your database. Sure, it's two conceptually separate concerns that are "coupled" gasp together, but maybe if I always want both of those things it's a net gain if the glue code is written and maintained by someone else.
Perhaps Luke is an architecture genius and has some way of addressing this without compromising the community's strong preference for small, single-purpose libraries. But in the more likely case, either some more comprehensive solutions need to appear, or we all just need to be OK with the fact of clojure bring a suboptimal choice for straightforward CRUD apps -- that is, 99% of web apps out there.