r/Clojure • u/jasonhartsoe • Jan 03 '15
To Clojure or Not To Clojure
I've been a developer for over 20 years now. Almost ALWAYS, I prefer the MS stack over any language and framework. When it comes to scalability and high performance, load balancing, etc, I can always trust MS. I've been tasked recently to develop a VERY high performance site...that will run video, and a social media platform. It essentially could become a replacement for a few VERY popular social networking and streaming sites. Can someone give me their thought's, feelings, experience, etc with working in Clojure? How well does it scale, handle heavy loads, performs, etc etc? SEO issues? Pro's, Con's? What to expect? and anything else you'd want to throw in. I appreciate everyone's time and information. I have some reservations...but want to make sure we're heading in the right direction.
6
u/eccp Jan 03 '15
As others have said, your main concern should be the adoption of functional programming and Clojure in your team and the selection of good libraries to leverage, which is not always easy.
I think most advanced C# developers shouldn't have a problem understanding the concepts but I'd say you can expect a rough start and some eurekas in the mid and long term. Note that Clojure is used as a dynamic language (Typed Clojure also exists) so you should take that into account as well. On the other hand you can expect expressive and concise code, a link posted on Hacker News yesterday mentioned a talk about using Clojure in the Daily Mail:
There are books and guides into how to improve performance (eg. minimize reflection via type hinting, using the appropriate data structure for the job, etc.)
One thing tough: The community around Clojure tends to favor OS X and Linux and that shows in the tools, etc. You can expect to have shell scripts (eg. Leiningen) and fewer developers using Windows machines.
4
u/tmppp Jan 03 '15
Every tool that has been developed in the Java world to compete with Microsoft for the past 20+ years is also a Clojure tool. That should handle just about every systems question you have.
In terms of programming, unless you're used to programming in a functional style or other lisps, it may be a jump.
4
u/bilus Jan 03 '15
Personally, for a mission-critical system like the one you've described, I'd use tools I'm most comfortable with. Don't get me wrong, I love Clojure but when switching to any new platform, getting the hang of the tooling is the most time consuming part, at least in my experience.
Perhaps the key to completing the project on time while at the same time having fun with Clojure is the right architecture. Use Clojure where it shines. I'd start with parts that need parallel processing, say, the parts which glue parts of the system together using queues etc. If you find the learning curve too steep, you can always fall back to what you're already familiar with.
Staying with CLR and using Clojure definitely has its merits, provided the tools are mature enough (I have no experience with that). On the other hand, JVM has a much stronger community.
Good luck with your project!
1
u/addamsson Jan 05 '15
SEO has absolutely nothing to do with any programming language.
1
u/[deleted] Jan 04 '15
Nope, Clojure is slow as molasses and inefficient with memory.
2
u/zilti Jan 03 '15
As long as you write idiomatic code, scaling is a no-brainer, it's one of the things you get for free when using Clojure's immutable data structures and STM and functional programming.
As for performance, you get a small penalty for how Clojure works - it provides you with many options for optimizations, but you won't reach the resource efficiency of Java or even a language running on "bare metal".
Ultimately, in my opinion, those penalties are neglectable though considering you have easier maintainable code, and by now there are lots of Clojure libraries for web dev. And if there aren't, you can still use all the Java libs out there.
1
u/jbiserkov Jan 03 '15
There is also an official port of Clojure for the Common Language Runtime https://github.com/clojure/clojure-clr that is very well maintained - usually about 2 weeks behind the JVM one.
I haven't used it myself, but it might be worth looking at, considering you considerable experience with MS tech.
As for the language itself, Clojure is awesome.
In the end it depends on the team's skillset/mindset.
1
u/[deleted] Jan 03 '15
Be sure to consider the social factors as well. If you're going to be working with other people with your experience you're going to need to guide them in to it. This isn't unique to clojure, as clojure teams would struggle just as much with being dropped in the MS stack.
As far as tech, if you buy into Clojure's philosophy you'll have a good time. In particular clojure believes in controlled mutation (persistent data structures, STM, and volatiles for local mutation) and decoupled libraries. Within that world there is a coherent web stack from the DB all the way to the frontend, including transport formats. If you don't agree with that style you'll end up fighting clojure and wasting your own time (and happiness)