Clojure-powered Startups
infoq.com
infoq.com
Risk encompasses many aspects of technical decisions and there's a complicated set of interactions between these aspects. Saying a single language minimizes risk makes little sense.
For instance, if you're building a straight-up CRUD web app Ruby on Rails minimizes risk best. If you're building a realtime chat service node.js minimizes risk best (and I say this as a longtime detractor of node, its not the best thing engineering wise, but it's an 80% solution).
While I'm glad the speaker enjoyed success using Clojure, I don't think we need a slogan to promote Clojure, we need more killer platforms. We need problem-spaces where when someone asks "What's the highest quality implementation of X?" people say, well, clojure has XYZ, it's way ahead of the pack.
To my mind where clojure hits the sweet spot is in mixing performance with elegance. It's got a fantastic balance there for web apps. I would love for clojure to be the answer to the question of "our app servers are too slow". However, the ecosystem is just not there yet.
Between noir, immutant, aleph, and vert.x I think we have a bright future there, but whether clojure will hit critical mass to become a dominant platform anywhere is nigh impossible to predict.
if you're building a straight-up CRUD web app Ruby
on Rails minimizes risk best. If you're building a
realtime chat service node.js minimizes risk best
I do not agree with you on this one. I'm not into Node.js precisely because (for now) I consider it to increase the risk of any project.Yes, your realtime chat will be easy to do with Node.js, but most web applications also need to talk to a database, and also need to do some background processing, and also need to communicate with third-party services through many protocols, sometimes hip, sometimes obscure and long-forgotten. And your app will also probably need at some point a freakishly boring admin filled with freakishly boring reports.
And building a multi-platform, multi-lingual project does lead to resource drainage and duplicate effort. This is one reason why Node.js is popular in the first place, because presumably people can share logic between the client and the server ; but in the larger context of things with Node.js I feel like I'm digging myself into a corner, just like I did with PHP several years ago.
Personally I'm starting to like the JVM more and more. Want to do a really scalable chat app in several lines of code? There's a solution for that [+]. Want to talk with the most obscure database in existence? The JVM can do it. Want to have your binaries work in 10 years from now? The JVM can do it. Want to use your hardware to the maximum? The JVM is the second best choice after C/C++. Want to make your sysops happy? The monitoring/profiling/deployment tools available for the JVM have absolutely no match.
If I'm doing node now, it's not maintaining some legacy crap from 5 years ago - it's straight up new development. I get to do what I want. I don't think that factor comes in to the equation enough when people are talking about efficiencies and productivity metrics and such.
I still do a fair amount of PHP - my productivity maintaining PHP apps written by other people 5-10 years ago is pretty different from PHP I write from scratch, getting to use modern tools/libraries/techniques.
Yes, atmosphere is pretty cool - I'm looking at adding it to a project this fall. grails install-plugin atmosphere ;)
Datomic (http://www.infoq.com/presentations/The-Design-of-Datomic) is going to be one of Clojure's killer apps -- it adds durability to Clojure's immutable, persistent data structures, and it rethinks datastore design, from the ground up, to take advantage of modern storage services.
http://www.vixu.com (my startup) is based on open source Clojure/ClojureScript CMS (and soon webshop) software. See https://github.com/fmw/vix for the code (planning some refactoring over the summer before the first official release). Also doing search related stuff in Clojure (see https://github.com/fmw/alida for demo code I wrote for my EuroClojure presentation).
Clojure brought the fun back to software development for me and made me a better developer in general. It is also a very pragmatic choice, with the expressiveness of Lisp and plenty of reusable Java code being available.
1 - You can go for the most popular languages: VB.NET, PHP, etc. Very easy to find people, lots of plugins, lots of support. This may be the way to go if you want something simple done in a small budget
2 - You can go for the niche languages: Haskell, Clojure, Go. that's more or less the "hipster hacker" way of doing things. Very difficult to find someone that can do even a Hello World, but once you find, they can write a scalable website in about 3 lines and connect to the newest nosql db in 2 lines more. This is good if you're the next twitter, fb, etc and your servers begin to melt even if serving login
(but then again, fb is in PHP and they added 'magic' in HipHop and infrastructure)
From what I understand, Yahoo! has a similar mix of technologies.
In both cases, you really can't say "are PHP".
(1) Modulo some in-house and open source extensions (like XHP) running on HipHop for PHP.
But if I were starting a new startup, I'd pick Clojure over anything else, hands-down.
That's the advantage.
[1] http://jan.rychter.com/blog/2010/7/5/clojure-w-fablo.html
Fablo is actually one of the most interesting startups on the Polish scene regarding technological challenges involved.
Is the CLR version have parity with the JVM version? Is it worth using at all?
I find that I really get a feel for a language only if I'm building something in it that's actually useful (as opposed to just following along with Hello World and Factorial primers).
So instead of using DataOutputStream, you have to use BinaryOutputStream.
Clojure doesn't wrap much, so that means very little code written for one VM runs on the other. Plus you don't have lein, which is a bit problem tooling-wise
(My Google-Fu is failing me; I can't find an attribution.)
While I really like the idea of writing HTML in Clojure, I like even more the idea of being able to have a HTML/CSS/etc expert, who doesn't necessarily know Clojure, be able to maintain the HTML instead of me.
Has anyone found what they think is a good solution?
Check out Enlive, it solves exactly this problem. HTML/CSS is separate from Clojure code and you fill out templates and stuff via CSS style selectors. It's sweet.
https://github.com/swannodette/enlive-tutorial
https://github.com/cgrand/enlive
Btw I think you can use Enlive with Noir, even though some of the examples from Noir use Hiccup, it's not a requirement.
[1] https://circleci.com [2] https://github.com/edgecase/dieter
Here I gave an overview of my experiment in building a web app entirely in Clojure: http://notehub.org/2012/6/16/how-notehub-is-built
This I think is the key bit of the story:
"At this point, we were still focused on using Ruby/Eventmachine as a cornerstone of our technology stack. But here we hit a snag. Yep. I’m gonna beat up Ruby, because it was a mistake.
...it doesn’t scale. ::ducks::
OK, that’s not completely fair. Ruby does scale. But it doesn’t scale well, or easily, and in benchmarking and stress testing, I was seeing that we were going to have a use a small truck load of resources at AWS, or spend a bunch of preciousssss developer time making it scale. It was too expensive. I wanted high user::machine density, and I didn’t want to have my developers do handstands to get it.
Yeah, I could’ve done lots of things. I didn’t have time to do that shit. Not with a four person team. Not with cash running out, and promises to keep, and no time to work for Ruby. I needed something that would work for me. This thing had to be FAST. It had to drive hardware to the limit without driving us crazy.
The bottom line is that it was too much work to make Ruby go fast enough.
...A little background on our application might help. Our job is to give prospective hotel bookers a view into what their options are. At the time we were making the decision to migrate from Ruby to Clojure, the system was using so-called “realtime” rates and availability checks with hotel suppliers to get that information. That meant that when a visitor conducted a search, we would spin up dozens of individual HTTP requests to hotel supplier sites to get rates and availability data at that very moment. We’d parse the responses, collate them, and present them back to the UI in just a few seconds.
You might ask why we didn’t cache that information, but suffice it to say there were significant business drivers for that decision.
Managing this concurrent (and long-running) IO was a major theme for us, and Ruby did so reasonably well using EventMachine. However, we had to normalize the returned data into a single unified data model, and none of our partners had simple (or compact) XML representations of the data, so not only did we have IO issues, but CPU-bound processing issues as well. The combination of the two made the EventMachine implementation suffer from less-then-stellar throughput, and because of Ruby’s green threads implementation and global interpreter lock, we had to run oodles of Ruby processes on each box to achieve reasonable throughput.
Perhaps just as importantly, the reactor pattern’s upside-down flow of control style of programming was (and is) a pain in the ass. It was hard to read, hard to maintain, and generally obstreperous.
..I can already year you Ruby folks protesting “Fibers!” and so on. Heh. Have fun storming that castle.
Clojure was a whole different story, and addressed these issues admirably, for all the reasons you’ll discover when you look into it further. "
http://www.colinsteele.org/post/23103789647/against-the-grai...
Though Erlang not as modern or elegant as Clojure, but there is also LFE and Joxa.
I still find it amazing that I can:
1) add a single line to my project.clj (which will set up dependencies and download libs),
2) add a single line to my :import section at the top of the source file,
3) there is no point 3. Just call Java libraries.
But the choice really depends on your application.
The default implementations of scripting languages do not scale, unless we making use of the advanced VMs or JIT techniques of alternative implementations.
A startup I was part of, made this discovery already back in 2002, when we moved our scripting based web framework, which was very much like Rails, but based on Apache/TCL, to the then early .NET beta.
I began my journey into Clojure about a month ago (after poking at it since last Sept) by diving into the "Clojure Programming" book recently published by O'Reilly. After finishing the book, I reached for Noir to fill my web-dev needs, as the idea of a "batteries included" framework appealed to me. But I ended up dropping Noir and adopting the approach explained in the book, i.e. loosely coupling the modules mentioned above.
Noir itself is built from some of those same modules, and it seems like a fine open source project, but I've found that I'm better off connecting the "lego blocks" together manually -- it's not a complex exercise and gives you a lot of freedom to experiment, learn and fine tune.
The Clojure mentality so far has eschewed all encompassing frameworks like Rails in favor of smaller interfitting libraries anyway.
Rails works very well if you stick to defaults. Each time you veer a little bit further from the defaults, things start to break (or at least require a lot more advanced knowledge to keep working).
We had a front-end in in JRuby-on-Rails, backend in clojure, in the same app/process. We had a "middle-end" which translated clojure->ruby and ruby->clojure, allowing us principally to use futures for parallelism and queuing. It worked really well at the start, but had tons of bugs. A nasty example was that we did email in SimpleMailer in Rails, but it was triggered from some backend functions, which in turn were triggered from the front-end. That meant that Ruby objects were being used in two different Ruby runtimes! Bugalicious.
Here's the library we extracted, if you really want to use this: https://github.com/circleci/cljr. My cofounder Allen talked about the experience at ClojureConj/west: https://github.com/arohner/clojurewest2012-slides/blob/maste...
Also didn't reddit switch from clojure/lisp-like language to python?
It's interesting that this thread has stayed on the front page of HN all day. I wonder how many people upvoted/participated in it without watching it? (I must admit, I participated without watching the whole thing.)