News for hackers. Stuff that matters.
Re:State of Clojure 2015: Survey Results by AlwaysBCoding on Thursday January 28, 2016 @03:26PM (#10991016)
My $0.02 on the state of Clojure -

For building stateful UI's Clojurescript + Reagent beats anything else out there.

For data science and algorithms Clojure beats anything else I've used.

For backend web development Rails is still miles ahead of any Clojure workflow.

Datomic is interesting but there's still too much incidental complexity to be super productive with it. It's hard to build a startup on Datomic because of the pricing and productivity hit, but could see it being useful in the enterprise where speed is less important.

I'm very interested in mobile development with Clojurescript on top of React Native, but haven't found a tutorial that wasn't written in hieroglyphics, so assuming that needs some more time to mature.

Re:State of Clojure 2015: Survey Results by calgaryeng on Thursday January 28, 2016 @04:01PM (#10991294)
> For backend web development Rails is still miles ahead of any Clojure workflow.

I feel the same way. And in my opinion, is a symptom of the "library vs framework" culture that is present in the Clojure community. While that is probably a good stance for the first 2 points in your list, in web development there are just so many already-solved-problems that you have to re-work without a framework.

Luminus looked good but seems to be shunned by the community.

Re:State of Clojure 2015: Survey Results by yogthos on Thursday January 28, 2016 @07:06PM (#10992571)
>Luminus looked good but seems to be shunned by the community.

Author of Luminus here, and that's news to me. It has over 20k downloads on Clojars and about ~50 downloads a day. https://clojars.org/luminus/lein-template

James Reeves has endorsed it as a good way to start Clojure web development. There's an active Google Groups list https://groups.google.com/forum/#!forum/luminusweb and a Slack channel on Clojurians.

Could you please elaborate on why you believe Luminus to be shunned by the community?

Re:State of Clojure 2015: Survey Results by gered on Thursday January 28, 2016 @04:47PM (#10991632)
> Luminus looked good but seems to be shunned by the community.

Can I ask what left you with that impression? I've no idea if this is true or not as I don't participate much in the Clojure community, I'm just genuinely curious. I guess a bunch of people just use the lighter weight Compojure/Ring templates that really leave you with an extremely barebones web app to start with?

I used Luminus myself when starting out, but I feel that as you grow more comfortable with Clojure web dev, you'd _typically_ end up putting together your own Leiningen template more tailored to how you like to set things up (as I ended up doing). But even still, I don't think Luminus is by any means bad?

Re:State of Clojure 2015: Survey Results by nickik on Friday January 29, 2016 @03:09AM (#10994109)
Shunned is a strong word and I don't think it applies. I think Luminis is ok for some things but by and enlarge most people doing webdev in Clojure prefere to go a different way.

Saying it is shunned makes it sound like a whitch-hunt but that not the case. I don't even think the community has an opinion on it. Most just dont use it.

Re:State of Clojure 2015: Survey Results by yogthos on Friday January 29, 2016 @09:03AM (#10995193)
The main goal for Luminus is to address the problems that newcomers would have. It's a batteries included template that sets up some reasonable defaults for your typical web app. That's coupled with a documentation site that explains how to accomplish different tasks using the platform.

Majority of the community are experienced Clojure developers, and have already found their own preferred setup. So, it's not terribly surprising that it's not the target demographic. Once you know the web stack, the libraries that work well, and how to put them together, then it's easy to make an app that's custom tailored to your needs. This is the primary reason for the libraries > frameworks mantra.

However, as the comments in this thread indicate, there's clearly a need for Luminus. Anybody who's new to the language and the ecosystem, needs a decent starting point. Luminus is that.

Re:State of Clojure 2015: Survey Results by AlwaysBCoding on Thursday January 28, 2016 @04:26PM (#10991498)
Yeah exactly, for building UI's less is more and the Clojurescript approach works really well. For building web apps, I really don't care how storing sessions, or configuring your web server or parsing HTTP requests is done, I just want it to work out of the box.
Re:State of Clojure 2015: Survey Results by sova on Thursday January 28, 2016 @07:54PM (#10992740)
Yeah, it's true. Although I personally learned a lot about HTTP when having to pick and pluck apart at Ring, but an out-of-the-box working stateful server / web backend would be MOST WELCOME in my clojure life.
Re:State of Clojure 2015: Survey Results by bad_user on Thursday January 28, 2016 @03:58PM (#10991274)
> For backend web development Rails is still miles ahead of any Clojure workflow.

If by web development you mean building frontends to a relational database. If on the other hand you mean web services, then I think Rails really sucks.

Re:State of Clojure 2015: Survey Results by zubairq on Friday January 29, 2016 @01:13AM (#10993795)
I've also built a Rails like system in Clojure which has easy SQL backend support. I actually find Clojure much EASIER than Rails backend, so I definitely disagree:

https://github.com/zubairq/AppShare

Rails is just such a different thing. Rails IS really is a framework optimised for the days of Page based web applications with small amounts of Ajax requests. Clojure is much more suitable to full web applications (SPAs)

Re:State of Clojure 2015: Survey Results by dkersten on Friday January 29, 2016 @07:04AM (#10994723)
If by web development you mean building frontends to a relational database.

In my opinion, yada[1] will change this with its concept of resources (eg it already has File and Directory resources for serving static data, but it wouldn't take much to develop a CRUD/DB resource - in fact, I spoke with Malcolm Sparks (the yada dev) about this).

I personally find the Clojure(Script) development experience, with figwheel, much better than my experience with both Flask and Django (never used Rails).

[1] https://github.com/juxt/yada/

Re:State of Clojure 2015: Survey Results by AlwaysBCoding on Thursday January 28, 2016 @05:48PM (#10992090)
Hm, I guess that's a valid point. I normally think of web apps as a frontend to a database, but could see why that's not the only use case. If you don't have a database associated with the service, can't you just use AWS Lambda or something? Is it necessary to maintain an entire separate project for it?
Re:State of Clojure 2015: Survey Results by plinkplonk on Thursday January 28, 2016 @11:31PM (#10993510)
"For data science and algorithms Clojure beats anything else I've used."

A very strong claim. Julia, R and Rust might have something to say about that.

Fwiw, I think Clojure is awesome. For data science though? (IMO) no(t yet). The Python ML ecosystem is miles ahead of Clojure's.

Re:State of Clojure 2015: Survey Results by AlwaysBCoding on Thursday January 28, 2016 @11:39PM (#10993532)
I mean, I like R, I think R Studio is an incredible IDE, but I would never build anything meaningful in R code. It's messy, slow, and has an antiquated community where people share library documentation in PDF's.

Julia seems promising, I haven't used it on a real project yet though, but I really like how easy it is to do data visualizations in the browser with Clojurescript and don't see Julia really having an answer for that.

Re:State of Clojure 2015: Survey Results by sooheon on Friday January 29, 2016 @02:26AM (#10993970)
What do you use for the browser visualizations? Gorilla repl?
Re:State of Clojure 2015: Survey Results by BorisVSchmid on Friday January 29, 2016 @05:25AM (#10994485)
As a scientist, I use a mix of Incanter, Quil, and gg4clj bridge to R's ggplot2 for visualization in clojure (none of these outputs to a browser though).

R's ggplot2 beats Incanter (or anything other charting library) by a large margin in its excellent mix of conciseness and power, but I find Quil pretty nice for animations (superimposing data on geographical maps, for example).

I keep an eye out for new charting libraries coming out for clojure. Last two I spotted were vizard from yieldbot (https://github.com/yieldbot/vizard), and what seems to have only been a small project, xvsy (https://github.com/dvdt/xvsy)

Re:State of Clojure 2015: Survey Results by thom on Friday January 29, 2016 @11:40AM (#10996246)
Hadn't seen those libraries before, thanks for the links.

I have to say, Quil is the least Clojurey library I have ever used, and I find it very, very primitive. There's definitely a huge gap for a project built with idiomatic Clojure bindings that can handle both nice graphical stuff but also stodgy charts, with basic stuff like annotation layouts etc. I think something that could work really well if anybody finds the time is a port of G:

http://geosoft.no/graphics/

Re:State of Clojure 2015: Survey Results by BorisVSchmid on Tuesday February 09, 2016 @05:31AM (#11064432)
Late reply, but ran into another plotting library, also from dvdt.

https://github.com/dvdt/gyptis

It is a nice wrapper around vega. Using that now.

Re:State of Clojure 2015: Survey Results by Lofkin on Friday January 29, 2016 @11:31AM (#10996174)
Julia will when it can compile to web assembly
Re:State of Clojure 2015: Survey Results by devty on Thursday January 28, 2016 @03:43PM (#10991151)
I had not realized that Clojure is well regarded in data science. Could you point to some libraries you find especially strong?
Re:State of Clojure 2015: Survey Results by thom on Thursday January 28, 2016 @05:55PM (#10992139)
I build a lot of stuff with Incanter[1], clj-ml[2] and Quil[3] for building visualisations. None of this is as joined up or as thorough as the equivalent R (or probably Python) bits. Clojure open source libraries are also incredibly prone to being abandoned. Wouldn't trade the language in for anything though, and I've never seen any R code that I would want to maintain myself.

[1]: http://incanter.org/

[2]: https://github.com/joshuaeckroth/clj-ml

[3]: http://quil.info/

Re:State of Clojure 2015: Survey Results by ohnomrbill on Thursday January 28, 2016 @03:49PM (#10991197)
I personally use this in place of R, where possible: https://github.com/incanter/incanter
Re:State of Clojure 2015: Survey Results by mej10 on Thursday January 28, 2016 @04:01PM (#10991291)
It has a very small portion of the mindshare. Almost everyone uses R, Python, or one of the proprietary things.

I use Clojure for any data science type tasks I have, but that is because I am primarily a Clojure developer.

It is very nice for a lot of basic data analytics -- but I doubt many full time data scientists use Clojure as their primary tool. The number of libraries available for R and Python is pretty amazing.

Re:State of Clojure 2015: Survey Results by dkersten on Friday January 29, 2016 @07:22AM (#10994791)
The number of libraries available for R and Python is pretty amazing.

I wrote some proof-of-concept code for submitting Python Celery tasks from Clojure. I should polish it up, get return values working and publish it... You could then farm out certain tasks to Python when it makes sense (eg because of existing code, libraries or just familiarity of team members). Best of both worlds, kinda ;-)

Re:State of Clojure 2015: Survey Results by mej10 on Friday January 29, 2016 @10:53AM (#10995858)
Check out Beaker Notebook if you haven't http://beakernotebook.com/

It has the ability to autotranslate data between different languages.

Re:State of Clojure 2015: Survey Results by dkersten on Friday January 29, 2016 @12:05PM (#10996452)
Thanks, that looks interesting. I'll take a deeper look over the weekend.
Re:State of Clojure 2015: Survey Results by thom on Friday January 29, 2016 @11:45AM (#10996296)
Yeah, the fact is, if an algorithm has a page on Wikipedia, it probably has a package in R.
Re:State of Clojure 2015: Survey Results by weavejester on Thursday January 28, 2016 @05:28PM (#10991943)
> For backend web development Rails is still miles ahead of any Clojure workflow.

In what way?

Re:State of Clojure 2015: Survey Results by jraines on Thursday January 28, 2016 @05:50PM (#10992098)
I think most are related to easiness, and so not recognized as an advantage by many Clojure acolytes (see: Rich Hickey's Simple Made Easy talk). Others are a consequence of shared state; also not recognized as a positive in Clojureland (rightfully so in most cases).

Here's my list:

- Database migrations

- Fast TDD (for some sub-Gary Bernhardt definition of fast) with access to the app environment.

- content negotiation

- Authentication with Devise and Omniauth

- Easy built-in support for caching

- Easy built-in support for background queue systems

- Easy support for one-off or occasional scripts with access to the whole app environment (rake tasks)

- Pry (yes, Clojure has awesome REPL powers, but Pry is so easy to use, and you have access to the whole app environment (no loading / switching namespaces or abuse of user.clj))

There's probably some solution to each of these. But all require you to find/know the options, and be able to evaluate which is best for you ("all REAL devs . . ." sure, sure). For Rails, all of these are available to you in the Rails Guides, except for Devise+Omniauth, which has an extensive wiki and tons of StackOverflow answers.

Re:State of Clojure 2015: Survey Results by weavejester on Friday January 29, 2016 @06:25PM (#10999365)
Thanks, that's a good list, and I see the problem.

Out of interest, what makes Pry easier to use? I'm not sure I understand the comment about having access to the whole app environment. In the Clojure REPL you do as well...?

Re:State of Clojure 2015: Survey Results by jraines on Friday January 29, 2016 @08:54PM (#11000112)
When I reflect on the ease of use question, I realize most of my frustrations with the Clojure REPL have actually been with trying to use it within an editor (Vim, Emacs, and Atom so far). And particularly with getting a ClojureScript REPL through those tools. That's not something I try to do with Pry, being content to use it from the terminal, so maybe not a totally fair comparison.

The app environment thing is mostly about having to switch between a lot of namespaces and/or to make sure they're all loaded upon starting the REPL. With Rails+Pry, you can work with any class in your app immediately. It also lets you put breakpoints in your code, where executing the code in a running process throws you into a REPL at that point, with all the local context up to that point of execution. Also, if you make code changes, you simply type "reload!" in the REPL and everything's up to date. I have a bookmark to read Stuart Sierra's post about his workflow to try to get a grip on how to come close to something like that in Clojure.

And it can do a lot more great stuff, too: https://www.youtube.com/watch?v=4hfMUP5iTq8

Oh and by the way -- thanks for all of your OSS work in the Clojure world! Especially taking the extra step of providing good docs.

Re:State of Clojure 2015: Survey Results by weavejester on Saturday January 30, 2016 @12:00AM (#11000587)
Have you tried using Cider under Emacs? Or Cursive? Both of those have debuggers that allow you to add a breakpoint in your code and then evaluate arbitrary expressions. They also allow you to step through each form and see the return value.

There are also a few projects for adding in debug REPLs, but those seem to have fallen by the wayside lately, perhaps supplanted by debuggers.

You might also want to talk a look at Duct (https://github.com/weavejester/duct), which is my ongoing and still early attempt at solving some of the framework problems with Clojure. If you create a template via Duct, like so:

    lein new duct foobar +site +cljs
Then you some of the things you're asking for. The namespaces of your application are loaded when you start `lein repl`. You get a `(reset)` function that reloads your code, restarts your application and pushes those changes dynamically to the browser. You also get a ClojureScript REPL that hooks into the browser.

There are also generators, migrations, database support etc., but currently all inferior to Rails. I'm probably going to be working on the generators next, as they need attention.

Re:State of Clojure 2015: Survey Results by jraines on Saturday January 30, 2016 @01:44PM (#11003118)
Thanks. One thing that looks promising for migrations is the language/ORM-independent tool Switch.
Re:State of Clojure 2015: Survey Results by weavejester on Saturday January 30, 2016 @05:04PM (#11003993)
Do you happen to have a link to that? It's not very Google-able!
Re:State of Clojure 2015: Survey Results by jraines on Saturday January 30, 2016 @06:35PM (#11004332)
Ha - especially when I misspell it: https://github.com/theory/sqitch
Re:State of Clojure 2015: Survey Results by akjetma on Thursday January 28, 2016 @05:46PM (#10992071)
'Lack' of frameworks. I always think it's kind of funny when starting a new Clojure web project, I have to explicitly insert a middleware for parsing parameter strings into a Clojure data structure, and then another middleware for transforming the string keys in that structure into keywords. There are just a bunch of things that don't magically work for you. That said, I really enjoy Clojure and appreciate/understand the high configurability.
Re:State of Clojure 2015: Survey Results by sveri on Thursday January 28, 2016 @06:39PM (#10992426)
Hi, author of closp (https://github.com/sveri/closp).

TLDR; Yes, clojure is behind in regards of web development, but it is not as bad as you said. There is active work done in this area.

I totally agree with what you said. It is a general understanding in the clojure community that you compose libraries to get things done. However, for web development that still means a lot of repitition, thats why I created the closp template.

It is based on luminus (http://www.luminusweb.net/) which is a lighter "framework" with more options.

My idea was to provide one way with sensible defaults to get started in doing web stuff in clojure.

I still work regularly on it and would be happy about contributions / feature requests. Whereas regularly means in terms of months as I do this all in my spare time.

Also I am quite active in the clojure community and I know that luminus is not shunned, but instead it also receives improvements and releases regularly. Also the author of luminus works professionally with clojure and with luminus.

And I have to admit, that luminus has the far superior documentation, he has done a good job on it I think.

Re:State of Clojure 2015: Survey Results by yogthos on Thursday January 28, 2016 @06:53PM (#10992492)
These are precisely the kinds of things that Luminus http://www.luminusweb.net/ addresses. The template generates a project with all these things configured with reasonable defaults for a typical application. Luminus will also setup things like a logging configuration, authentication, databases, Swagger API, etc.

I think the fact that these things aren't magically is a big plus. You can use the defaults, but you can trivially customize the middleware stack for your specific needs.

Another thing to note is that a lot of the stuff that traditional frameworks do is geared towards doing presentation on the server. Modern apps tend to do presentation on the client, and the server primarily provides a set of stateless services for the client to fetch the data that it needs. With this approach, you don't really need a complex server framework in the first place.

Re:State of Clojure 2015: Survey Results by retrogradeorbit on Thursday January 28, 2016 @08:00PM (#10992765)
Use destructuring to pull the needed values out of the ring request. For example:

(defn login [{{:keys [email password]} :params session :session}] ...)

Also remember as well as the :keys special form you have :strs and :syms.

https://gist.github.com/john2x/e1dca953548bfdfb9844

Re:State of Clojure 2015: Survey Results by AlwaysBCoding on Thursday January 28, 2016 @05:50PM (#10992107)
Oh man, and having to manually configure your server logs just so you can see what requests are being made and where errors are popping up vs. just tailing log/development.txt in Rails...
Re:State of Clojure 2015: Survey Results by mej10 on Thursday January 28, 2016 @04:14PM (#10991400)
I only agree about 20% with this assessment of Datomic.

Their "Pro Starter" tier is free. It is plenty to get started with for many use cases.

It doesn't take _that_ long to get up to speed with how it works and how to use it, and if it fits your problem naturally then it can save you so much time and headache.

That being said, I can understand people hesitating to use it.

Re:State of Clojure 2015: Survey Results by AlwaysBCoding on Thursday January 28, 2016 @04:22PM (#10991466)
I don't think Datomic takes that long to wrap your head around, but it does take a long time to actually use. There's no inherent equivalent of Model.all or Model.where(x = y), so chances are that you'll have to write your own DSL for mapping domain objects to datomic queries which is a time consuming non value-adding activity. You'll also likely want to transact through some DSL so that you can do validations, and post-creation lifecycle hooks, where in Rails or something you'd just get that for free. The Devops is pretty frustrating imo, there's no equivalent of the Heroku Postgres or AWS RDBMS one-click deploy for Datomic, so you'll need to set it up and monitor it yourself, which can get tricky when doing things like REPLing into the db from your local Emacs shell can crash a process downstream somewhere because you went over your remote peer limit without realizing it. And there's no view that shows you the IP address of every connected peer, so it's kind of hard to debug what exactly is going on sometimes. I think the query engine is really cool, I just feel like I waste a lot of time using Datomic that I don't with other databases.
Re:State of Clojure 2015: Survey Results by michel-slm on Thursday January 28, 2016 @08:00PM (#10992761)
Thanks for that; been meaning to try CLJS+Reagent for a side project and the external testimony helps.
Re:State of Clojure 2015: Survey Results by ff_ on Friday January 29, 2016 @04:20AM (#10994301)
Try re-frame, is built on top of Reagent to provide some more magic (and the README is just AWESOME, worth reading it): https://github.com/Day8/re-frame
Re:State of Clojure 2015: Survey Results by nextos on Thursday January 28, 2016 @05:03PM (#10991746)
I love everything about Clojure, except that stats libraries are nowhere comparable to Python sadly.

It's probably still better for building a big ML solution, but sadly for small prototypes it's too much effort.