This is a discussion on Uber Conf 2010 - Day 4 Report - OSGi/Java EE in GlassFish and Getting Started with Cl - Solaris Rss ; Uber Conf Day 4 (Day 3 , 2 , and 1 ) 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 ...
Uber Conf Day 4 (Day 3, 2, and 1) 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:
OSGi & Java EE in GlassFish - Best of both worlds
The remainder of the day was spent in Clojure track by Stuart Halloway. Next are some basic notes for getting started with Clojure:
Why Clojure ?
Together, these features add up to simplicity. Simplicity means
- Power (hosted on jvm)
- Robustness (functional)
- Concurrency (identity, state, time)
- Abstraction (OO done right)
- Focus (lisp)
Simplicity does not mean
- absence of incidental complexity
- sufficient to meet your design constraints
Lot of code in Clojure is not about "set" something, its about invoke a function on it.
- 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
How to get started ?
Download the latest stable release or cutting edge build. 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.mainClojure 1.1.0user=> (print "Hello World")Hello Worldniluser=> ^DOR
~/tools/clojure/jun7 >java -cp clojure.jar clojure.mainClojure 1.2.0-master-SNAPSHOTuser=> (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/Enclojure, Eclipse/Counterclockwise, Maven, Max/Linux command line, Windows command line, IDEA/La Clojure, and Emacs.
Configuring Clojure in NetBeans using the Enclojure plugin with NetBeans 6.9 gives the following error:
but works easily with NetBeans 6.8. 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)
Compojure is a small, open source Web framework for Clojure based upon Ring (similar to Python's WSGI and Ruby's Rack). Otherwise Clojure apps are deployed as a JAR file.
- "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
A subsequent blog will show how to deploy a simple Clojure JAR file and a simple web app using Compojure on GlassFish.
And finally, here are my top-10 reasons (in no particular order) that I'd like to attend UberConf next year:
See ya next year, hopefully!
- 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
Check out the complete set of pictures at:
Technorati: conf uberconf denver clojure compojure glassfish netbeans javaee osgi
Read More about [Uber Conf 2010 - Day 4 Report - OSGi/Java EE in GlassFish and Getting Started with Clojure...