6 ms·
I've been using Scala just to learn Play framework (I know I could use Java but I thought I'd be adventurous). I think in truth, though, if there were a web fr
by fat0wl 13y ago
I've been using Scala just to learn Play framework (I know I could use Java but I thought I'd be adventurous).
I think in truth, though, if there were a web framework in Clojure as well received as Play I would be bounding down that path instead. Clojure seems to be where a lot of the JVM interested is heading yet we're not there yet for some reason.
- jadyoyster 13y agoI've been wondering - having never used a web framework except for some RoR - what people miss in the idiomatic Clojure way of doing web (composing libraries like Ring, Compojure, Enlive etc). Care to share?
- fat0wl 13y agoHonestly I haven't used Ring/Compojure/Enlive beyond tutorials so at this point I'm very intrigued but don't have much to say yet. My belief though is that there is some peace of mind that comes from the idea of what you might call "page composition" -- that this piece of data sits in this template, that it rides on top of this simple model, that it is in ORM from database. There is a huge amount of linearity and convention throughout the stack and because of the dynamic nature of Ruby lots of gems can be sprinkled throughout without one really understanding what they do. Now, I'm certain this level of abstraction and functional/mixin kindof stuff can be achieved in a Clojure framework but I think it is generally perceived as being a bit more non-linear and DIY (libraries not necessarily playing nicely together). As in "yes I can get all of these pieces together but then if down the line I have to change this piece, how will I accomplish it without breaking everything". Essentially, I think the perception of OO is more alluring in terms of project cohesion, whereas functional programming is seen more of a supposedly incorrect assumption that an HTML document is simply an assembled mass of text. I'm really just trying to convey that RoR and the like seem to be making a COMPLETE ("in a few lines I can do anything short of my business's custom domain logic") framework out of the box and perhaps there is some stigma attached to the nature of Lisp that makes it seem as though framework developers are not striving to cross these bridges and there is less of a community to keep them in check. Eh, I wish that made more sense but this is a lot of conjecture based on perceptions -- it's clear that a lot of these communities emerge from hype & reactionary values moreso than anything else. People wanted to shift away from PHP and be more productive without getting radically far away conceptually. I just got dizzy thinking about this lol... but yeah I think Java developers are a bit more open-minded when it comes to application development, seeing things more matter-of-factly than the languages with only MVC/Model2 kind of frameworks. I think if an attractively-packaged Clojure library were to emerge and get the right publicity (sad but thats how the web dev world is...) it could steal the hearts of many Java devs. In my limited experience with Clojure it seems fun AND powerful. Yes there is a learning curve but that is to take it above and beyond. The simple functionality of most web apps could probably be achieved without writing anything too mind-bending. Please do respond even if that response involves completely ignoring my rambling... I'm very curious to understand the Clojure community better :)
- jamii 13y agoMaybe check out http://pedestal.io/ http://pedestal.io/ "Clojurists looking for a standard way to build internet applications will love Pedestal. Rather than composing art out of found objects, they will now be able to mold a single, consistent form to match their vision. Pedestal may also appeal to developers who have been nervously approaching a functional language but who haven't yet mustered the courage to ask it out on a date. It provides a sterling example of how to use the Clojure ecosystem to its best advantage, reducing the friction usually associated with a language switch."
- danneu 13y ago> My belief though is that there is some peace of mind that comes from the > idea of what you might call "page composition" -- that this piece of data > sits in this template, that it rides on top of this simple model, that it > is in ORM from database. There is a huge amount of linearity and convention > throughout the stack and because of the dynamic nature of Ruby lots of gems > can be sprinkled throughout without one really understanding what they do. Actually, the problem with OO and my experience with Rails is this linearity quickly becomes a web where deriving the sequence of events encompasses more and more of your time as the project grows. Objects call objects across the system and change the state of each other without care. Making a trivial change involves unrolling this web every time. And that's why I think you have this backwards: > Now, I'm certain this level of abstraction and functional/mixin kindof stuff can be > achieved in a Clojure framework but I think it is generally perceived as being a bit > more non-linear and DIY (libraries not necessarily playing nicely together). As in > "yes I can get all of these pieces together but then if down the line I have to change > this piece, how will I accomplish it without breaking everything". `require`ing a Ruby gem is as non-linear as you can get. It's global with no entry-point. A gem's presence and effects are not obvious. They're often configured with some mutation like: MyGem.config do |c| c.key = "secret" end Meanwhile, it's obvious when a namespace of Clojure functions is included. And since they're just functions, they're trivial to compose. Completely different experience from what I was used to in Ruby.
- fat0wl 13y ago
- danneu 13y agoI was a full-time Rails developer until a crescendo of disillusionment finally cajoled me to learn Clojure. I don't really know that I miss anything. The things I might've thought I'd miss are the things that ended up souring the taste of Rails. Having to come up with my own abstractions or recreate familiar conventions or set up a database were areas where I had to cut my teeth, but I also had to cut my teeth on Rails when I was learning it. Rather than missing anything from Rails, I find myself using Rails' conventions as a loose model and then simplifying it. For example, my "templates" are now just functions that render html. My "layouts" are just functions that get applied to templates. I don't need to read Rails' template rendering guide to come up with a hack. Instead, modifying my templating system is trivial and obvious.
- nikatwork 13y agoThank you for this comment. I'm starting a hobby webapp project and wanted to try Clojure but was probably going to choose RoR out of fear. Now I'll use Clojure :) Would be interesting to see a blog post demo'ing your workflow.
- adambard 13y agoNot the parent, but I went through a phase of blogging about Clojure earlier this year: http://adambard.com/blog/Getting-started-with-Clojure-web-apps/ http://adambard.com/blog/Getting-started-with-Clojure-web-ap...
- girvo 13y agoI agree with my sibling, would love to know about your Clojure workflow/arch more!
- danenania 13y agoI'm working with these libraries for a web project now, and I'd say the main problem is lack of comprehensive documentation. If you're doing something slightly off the beaten path and get stuck, it's quite likely that you'll have to resort to the source code to solve your problem. There's nothing so terrible about that per se--it's a great way to learn--but it can feel like a high friction workflow compared to Rails, especially getting started. I think it's primarily a function of community size and library maturity, but there's a cultural element as well. Rails has more of a beginner-friendliness-is-good mindset (even when library internals are fugly), while in Clojure the focus is more on the strength of the functionality and less on easily grokkable apis (though there are notable exceptions).
- puredanger 13y agoThis space for Clojure is changing rapidly. The prevailing approach to web dev in Clojure has been to assemble the (already available) libraries that you need into an application. For some, that's sufficient. Others likely need more structure. The Luminus micro-framework (http://www.luminusweb.net/ http://www.luminusweb.net/) is a great choice providing a starting structure around existing libraries. Caribou (http://let-caribou.in/ http://let-caribou.in/) is a more full-featured framework for building web apps. Pedestal (http://pedestal.io/ http://pedestal.io/) provides heavy-duty tools for creating data-heavy single-page apps. And there's a new book on the way about Clojure web dev http://pragprog.com/book/dswdcloj/web-development-with-clojure http://pragprog.com/book/dswdcloj/web-development-with-cloju....