Uber Conf 2010 - Day 4 Report - OSGi/Java EE in GlassFish and Getting Started with Cl
Uber Conf Day 4 (Day [URL="http://blogs.sun.com/arungupta/entry/uber_conf_2010_day_3"]3[/URL], [URL="http://blogs.sun.com/arungupta/entry/%C3%BCber_conf_day_2_trip"]2[/URL], and [URL="http://blogs.sun.com/arungupta/entry/%C3%BCber_conf_day_1_trip"]1[/URL]) started with yet another 10 miler with fellow attendees in 1 hr 18 mins and 7:49 pace. It was slightly slower than the day before - guess physical exhaustion was setting in ;-) Here are the mile splits:
Thanks to Andy for showing how to turn on the Auto-Lap feature in Garmin 305 ... really handy!
I gave a talk on how GlassFish provides a great execution environment for deploying OSGi, Java EE, and hybrid applications easily. The slides are given below:
[B][URL="http://www.slideshare.net/arungupta1/osgi-java-ee-in-glassfish-best-of-both-worlds"]OSGi & Java EE in GlassFish - Best of both worlds[/URL]
The remainder of the day was spent in Clojure track by [URL="http://www.nofluffjuststuff.com/conference/speaker/stuart_halloway"]Stuart Halloway[/URL]. Next are some basic notes for getting started with Clojure:
Why Clojure ?
[LIST] [*]Power (hosted on jvm) [*]Robustness (functional) [*]Concurrency (identity, state, time) [*]Abstraction (OO done right) [*]Focus (lisp)[/LIST]Together, these features add up to simplicity. Simplicity means
[LIST] [*]absence of incidental complexity [*]sufficient to meet your design constraints[/LIST]Simplicity does not mean
[LIST] [*]Familiarity has nothing to do with simplicity [*]its not superficial, goes to the bone (e.g. only simpler syntax is just a sugar wrapper, look for the supported idioms) [*]does not mean easy, its very hard to be simple[/LIST]Lot of code in Clojure is not about "set" something, its about invoke a function on it.
How to get started ?
Download the latest [URL="http://code.google.com/p/clojure/downloads/list"]stable release[/URL] or [URL="http://build.clojure.org/"]cutting edge build[/URL]. The Clojure REPL (Read-Evaluate-Print Loop) is the easiest way to run a Clojure program as shown below:
~/tools/clojure/clojure-1.1.0 >java -cp clojure.jar clojure.main[B]Clojure 1.1.0[/B]user=> (print "Hello World")Hello Worldniluser=> ^DOR
~/tools/clojure/jun7 >java -cp clojure.jar clojure.main[B]Clojure 1.2.0-master-SNAPSHOT[/B]user=> (print "Hello World")Hello Worldniluser=> ^DNotice, the first fragment shows how to run REPL using the latest stable release and the second fragment shows the same using the cutting edge build. "Ctrl+D" exits the REPL shell. Stuart mentioned that the Clojure community stays on the cutting edge build most of the times.
Alternatively, you can also clone "labrepl" from "http://github.com/relevance/labrepl" which is an environment for exploring the Clojure language. It also provides complete instructions for getting started with NetBeans/[URL="http://www.enclojure.org/"]Enclojure[/URL], Eclipse/[URL="http://code.google.com/p/counterclockwise/"]Counterclockwise[/URL], Maven, Max/Linux command line, Windows command line, IDEA/[URL="http://plugins.intellij.net/plugin/?id=4050"]La Clojure[/URL], and Emacs.
Configuring Clojure in NetBeans using the [URL="http://www.enclojure.org/"]Enclojure plugin[/URL] with NetBeans 6.9 gives the following error:
but works easily with [URL="http://netbeans.org/downloads/6.8/index.html"]NetBeans 6.8[/URL]. The IDE seem to support REPL, Java/Clojure integration, syntax highlighting, brace/paren/bracket matching, code navigation, debugger and lots of interesting features.
Here is a typical REPL getting started session with NetBeans and Enclojure:
Here are some equivalent syntax with Java:
Semantic Java Clojure new new Widget("foo") (Widget. "foo") Access static members Math.PI Math/PI Access instance members rnd.nextInt() (.nextInt rnd) Chaining access person.getAddress().getZipCode() (.. person getAddress getZipCode) [LIST] [*]"defn" is a symbol so no new syntax for adding a method. [*]^ introduces metadata for the next symbol, "greet" in this case. You can put metadata anywhere. [*]"clojure.core" is the core of Clojure's implementation [*]"javadoc" knows the default JDK javadocs, can make a local copy and/or extend it [*]"show" is Java reflection [*]"dir", "show", "source" are promoted from community version to the bleeding edge build. [*]Source is not always exposed [*][1 2 3] Call the function 1 with arguments 2 & 3. [*]'(1 2 3) don't evaluate it and print as is, just tick it. [*]Idiomatically Clojure requires less parentheses than Java [*] Every single function in Clojure is Runnable and Callable
[*] Java interop is simple, wrapper-free (raw), performant, complete
[/LIST][URL="http://github.com/weavejester/compojure"]Compojure[/URL] is a small, open source Web framework for Clojure based upon [URL="http://github.com/mmcgrana/ring"]Ring[/URL] (similar to [URL="http://wsgi.org/wsgi/"]Python's WSGI[/URL] and [URL="http://rack.rubyforge.org/"]Ruby's Rack[/URL]). Otherwise Clojure apps are deployed as a JAR file.
A subsequent blog will show how to deploy a simple Clojure JAR file and a simple web app using Compojure on [URL="http://glassfish.org"]GlassFish[/URL].
And finally, here are my top-10 reasons (in no particular order) that I'd like to attend UberConf next year:
[LIST=1] [*]Long 90 minute sessions [*]Lots of hands-on workshops [*]Fun Run as part of the formal agenda [*]Beautiful location (Westin Westminster) with lots of running trails [*]Great food (breakfast + lunch + dinner) [*]Small attendance so intimate discussions with speakers [*]Great set of speakers [*]Rarely see session hopping [*]Pure technology, no product pitching [*]Swags are nice - bracelet-style USB stick with all the presos, 2 different tee-shirts, fancy folder and some additional goodies for speakers[/LIST]See ya next year, hopefully!
Check out the complete set of pictures at:
Technorati: [URL="http://technorati.com/tags/conf"]conf[/URL] [URL="http://technorati.com/tags/uberconf"]uberconf[/URL] [URL="http://technorati.com/tags/denver"]denver[/URL] [URL="http://technorati.com/tags/clojure"]clojure[/URL] [URL="http://technorati.com/tags/compojure"]compojure[/URL] [URL="http://technorati.com/tags/glassfish"]glassfish[/URL] [URL="http://technorati.com/tags/netbeans"]netbeans[/URL] [URL="http://technorati.com/tags/javaee"]javaee[/URL] [URL="http://technorati.com/tags/osgi"]osgi[/URL]
[url=http://feedproxy.google.com/~r/MilesToGo/~3/Ks81Que6tWU/uber_conf_2010_day_4]Read More about [Uber Conf 2010 - Day 4 Report - OSGi/Java EE in GlassFish and Getting Started with Clojure...[/url]