Tuesday, June 2, 2009

JavaOne 2009: Clojures for the JVM by Rich Hickey

  • Fundamentals: it is a dynamic language and a new LISP, Functional, Supporting Concurrency, Compiles to JVM bytecode, not OO

  • Why not OO? Because OO encourages mutable state and Mutable stateful objects are the new "spaghetti code". His words, not mine! :)

  • Supports a REPL (read-eval-print-loop)

  • Load/change code in running program

  • On Data Types it has, for example, Arbitrary Precision Integers, Ratios (no precision loss?), doubles, BigDecimals...

  • On Composite Data Structures it has, for example, Lists, Vectors, Maps, Sets and everything nests

  • Data structures are the code, not text-based syntax and everything is an expression

  • All data structures are immutable; performance problems are avoided by two rules: new versions are not full copies and make use of a structural sharing of data (this last one is kind of hard to put in a few words here)

  • Abstraction-based library built on concrete classes for structures with a Java Interface

  • Clojure supports prallel computation, mostly because it focuses on concurrency, which is made easy by using immutable data; no locks needed

  • The only thing that mutate are references themselves, in a controlled way

  • Clojure uses MVCC - Multiversion Concurrency Control through the command dosync which is the transactional control done by databases

  • Clojure integration with Java is natural beacause the data types are the same as Java; it has debugging support and all the Java bytecode infrastructure works with Closure

Why is it that everytime I see a brand new language or programming paradigm it reminds me of everything I learned 15 years ago at College? My words, not his! :)

No comments: