by taeric · 13y ago · 0 comments
As an aside, are there any good rundowns of using a LISP for web development? I don't personally see it recommended/done a lot. Curious if that is just my exposure, or if it gels with reality.
Personally, I've never quite "gotten started" with lisp (neither cl or scheme) -- and while I don't know if I'd recommend Arc -- the system on which it is built, which has evolved into racket:
Is as far as I can tell, really, really good. Both the implementation, the tooling, the documentation and the community.
For more on racket and web:
http://docs.racket-lang.org/web-server/
See also: http://stackoverflow.com/questions/4285617/how-do-i-install-...
The hype definitely seems to be on the side of clojure, and clojure+leiningen (the build system) gains quite a few advantages from running on top of the jvm. My guess is that you'll find a lot more libraries and code for using clojure for web programming than probably any other lisp -- and code that people are invested in at that (code that people depend on for running their own projects/businesses etc).
My Clojure workflow is much better than my Ruby workflow. It's easier to glue things together. My feedback loops are faster (like being able to eval code in my source file). The domain is simpler. So are APIs.
You don't hear about people using lisps because the communities are small. There's a self-fulfilling barrier to entry. And it certainly is a smaller world. The good part is that the quality/intelligence per capita is high. But the bad part is that I'm bringing the average down. I definitely feel it in #clojure.
But I went back to Ruby and Rails for my recent projects and I'm just way faster at it. It's so much easier to use and the way the gems glue themselves and integrate with my projects saves so much time.
If there was a way to get something like this in Clojure or Common Lisp (I haven't tried Common Lisp) then I'd go back to it.
`gem install devise`, a few more incantations, and now you've got a full authentication/forgot-password/email-verification system up and running within 5 minutes. CSRF protection is included with a `protect_from_forgery` link in the ApplicationController and you don't need to know what CSRF is.
But at a point I find myself at the whim of Devise's Github Wiki to expose the method I need to override to make a trivial change. And as I diverge from the base-case of the gems in my Gemfile, I'm spending my time credentializing in gem source code to do trivial things. I need to make what should be a 5 second change to an API endpoint, but we used RABL because it was easy and now I'm back on its Github page hunting down its API doc.
Those chickens had never really come home to roost until I was a full-time Rails developer working on a monolithic app where my days became squandered to pay back technical debt by specializing in the intersection of codebases that were not my own.
That's what brought me to Clojure which I was pretty much sold on after reading about Ring (https://github.com/ring-clojure/ring/wiki/Concepts). A request is just map. Your app is just a series of functions that transform that map. And a response map comes out the other side.
In Rails, to reset a session, you call a magical method `reset_session`.
With Ring, you return the response map with its `:session` key set to `nil`.
Implementing features is much more obvious now. The hard part is figuring out how to structure and fit together the app. Especially since Rails made most of those decisions for me.
I started building a forum with Clojure and Datomic: https://github.com/danneu/clj-forum
My goal is to eventually arrive at a webapp structure that I can replicate in future Clojure webapps.
I don't really know how to use Datomic or how to organize my code or what abstractions will work, but I have a clay-ball approach to it all where I just do what's good enough now and refine it later.
But it's coming together.
If you start in the handler (https://github.com/danneu/clj-forum/blob/master/src/clj/foru...), you can get a sense of what's going on.
- Here's an attempt at recreating some of the Ruby CanCan authorization lib: https://github.com/danneu/clj-forum/blob/9c0d2b8f17acc06da9a...
- And here are the tests for it: https://github.com/danneu/clj-forum/blob/9c0d2b8f17acc06da9a...
Yeah, that was a longer post than I thought I'd write but I've been alone in my Clojure cave for a while now, complecting.
What you describe about Rails is a problem with using third party library/framework in any languages. I don't know how you can avoid that in Clojure.
Me too, my friend, me too.
It's all about attitude. With Ruby/Python/PHP people rarely express strong sentiments over the language choice. Typically, you can easily convince the team going this or that way, depending on the task. Everybody understands those are just tools.
However, when it comes to non-mainstream languages such as Lisp, people become more galvanized. Negative sentiments are likely to shift from 'meh, whatever' to 'you must be mad'.
That's why I say think twice. You might alienate some people -- if that's something you care about.
Whereas in the Lisp world, you have so much flexibility that you can end up with all sorts: some people doing pure functional code, some OO, some using tail recursion wherever possible vs. some preferring more explicit representations, some going heavy on the macros, some using LOOP, some preferring recursive mappings of anonymous functions, etc...
Ultimately, this can be fixed by using a decent style guide. Google has a good example since they acquired ITA:
http://google-styleguide.googlecode.com/svn/trunk/lispguide....
In other languages it isn't so much of a problem - eg. I'm thinking of Python as an example where you are strongly encouraged that there is "only one way to do it".
However, if you recognise from the beginning that you need to enforce a decent style guide, then I see no reason why large Lisp teams couldn't work.
It's exciting! In the case of Lisp, it's not just about enforcing styles, but (as a team) coming up with the appropriate DSL for the task at hand. The classic 'bottom-up' paradigm (http://www.paulgraham.com/progbot.html), but done collaboratively.
The analog has been done to death in object oriented languages, with concepts such as design patterns and frameworks. I'd love to see similar developments in a meta-language like Lisp, and with all the (potential) power that entails...
I'm working on a side project, using Common Lisp for a webapp. So far it's nice. General reports indicate that current open source Lisp systems works reasonably well under smaller load.
EDIT: Actually the JVM is still involved but just for compilation.