Monday, September 21, 2009

Benefits of using Clojure (Lisp) in web/enterprise development

This post is my attempt at replying Ivan's question:

http://bitumenframework.blogspot.com/2009/09/introducing-bitumen-framework.html#comments

Benefits in web/enterprise application development are more of a corollary to how Clojure/Lisp addresses the problems in imperative-style development. To help myself substantiate that statement, I would rather point you to these:

Rich Hickey's talk at the JVM Summit
http://wiki.jvmlangsummit.com/images/a/ab/HickeyJVMSummit2009.pdf

Paul Graham's story about ViaWeb
http://www.paulgraham.com/avg.html

The practical web/enterprise app development scenario today includes
1. very high concurrency (traffic)
2. multi-core processors (hardware)
3. lock-based multi threading (prog model)
4. syntax and semantics bloat (Java)
5. complex business logic (business)
6. time-to-market issues (business)
7. performance issues (hardware / prog model)
8. scaling issues (hardware / prog model)
9. external Java libraries (prog model, Java)
10. lot of coding and bug-fixing (prog model)

Clojure is LISP-1, and has
(a) absolutely minimal syntax and great Java compatibility, which helps you deal with 4, 5, 6, 9 and 10
(b) very fast persistent data structures (with immutability and structure sharing), which help you deal with 3, 4, 5 and 10
(c) multiple flavors of anonymous functions (lambda) that make your programming model simpler
(d) macros, that let you extend the syntax and generate DSLs
(e) meta-programming, that lets you create very powerful programming constructs
(f) multi-methods, that are way more powerful than polymorphism
(g) type hints, that help you deal with 7
(h) multiple elegant concurrency solutions (few relevant links listed below), which help you deal with 1, 2, 3 and as a result also 8 to some extent

http://bc.tech.coop/blog/081201.html
http://clojure.org/concurrent_programming
http://blip.tv/file/812787

(i) data structures that are functions and functions that are data, which helps you mix and match constructs in your programming model with extreme flexibility
(j) last but not the least lots of parentheses :-), which are actually a lot friendlier than they may seem at first (to the extent that they are actually a feature to help reduce syntax clutter)

As you would notice, Clojure provides a much higher power-to-weight ratio (in terms of expressiveness, flexibility, fitness and hygiene) when compared to other imperative languages. However, there are scenarios where you may be better off using Java rather than Clojure -- those include cases where pure performance matters more than everything else.

This post barely scratches the surface of what Clojure is all about. Take some time to explore the language -- I hope the benefits you discover will be be nothing short of amazing.

Friday, September 11, 2009

Introducing the Bitumen framework

Bitumen framework is a collection of Open Source libraries to make application development on the Java Virtual Machine easier. It fully supports Java and Clojure for now, and other JVM languages may be supported in the future.

Bitumen tries to ease the development in a non-invasive way. Each library may be used independent of each other. In some cases however, there may be inter-dependency. Another fact is Bitumen libraries are (and will remain) XML-free. There is easy-to-use API, which you can integrate with your preferred style of configuration.

The Bitumen framework is hosted here: http://code.google.com/p/bitumenframework/

Why another framework?
I was not being able to make web development suck less with the existing Open Source projects. So, I took on this task and the result is Bitumen framework. Take a look at the libraries - there might be something you would find useful.

What are the libraries available?
Jettify - Tiny wrapper to easily embed the Jetty servlet container
JWebMVC - A minimalistic, REST-compatible servlet based web framework
More libraries are planned.

What is with this name? (Asked by Deepak)
Bitumen is used for making roads, hopefully this resembles "foundational". :-)

I am interested - I want to talk.
Your feedback is most important. Consider joining the Discussion Group. Contributions in all forms are most welcome.