Uncategorized

Dabbling in Clojure

Posted on March 16, 2009. Filed under: Uncategorized | Tags: , , , , |

Clojure (http://www.clojure.org) is a Lisp implementation running on the Java Virtual Machine, written primarily by Rich Hickey and designed for simple and reliable concurrent programming. Clojure is a radical departure from the more conventional languages such as C, C++, Java, and Ruby. As a functional language, using it requires a different outlook and thinking style.

Code written in Lisp or Clojure may appear to the uninitiated to be a confusing excess of parentheses and other seemingly cryptic text. In fact, I used to be one of the multitude who dismissed these languages with a mere “too many parentheses” as a feeble rationalization. However, after working with it for a bit I have instead come to view it with respect and even awe.

The Clojure community is a bright and helpful bunch; I often consulted them on the #clojure IRC channel, and the Google group at http://groups.google.com/group/clojure has had some very useful information as well.

The previous article (JRuby — A Better Language for the Java Virtual Machine) discussed using JRuby as a better language for programming on the JVM, and used as an example a Fahrenheit/Celsius temperature conversion Swing program. I’ve ported this program to Clojure so that we can contrast Clojure with Java and JRuby using a known quantity.

Here is an image of the application’s sole window. There are text fields for entering the temperature, and buttons and menu items to perform the conversions, clear the text fields, and exit the program.

The Fahrenheit  Celsius temperature conversion Swing app window

the temperature conversion Swing app window

(more…)

Read Full Post | Make a Comment ( 8 so far )

JRuby — A Better Language for the Java Virtual Machine

Posted on February 26, 2009. Filed under: Uncategorized | Tags: , , , , , , , , |

A powerful synergy results when combining the power, reliability, portability, and rich library set of the Java platform with the power and flexibility of JRuby.  This article will discuss a couple of ways in which JRuby surpasses Java as a programming language for the JVM:

  1. Code as first class objects – code blocks, lambdas, and procs can exist and be passed around for the most part like any other objects. There is no need to create a class to contain them as there is in Java.
  2. Syntactic sugar for the specification of hash values as parameters – hash (map, in Java lingo) key/value pairs can be passed to a function literally, and the function will receive them as a single hash. In other words, they can be passed without the need for the programmer to create and populate a hash instance.

In order to contrast Java and JRuby, and showcase the above features, we will implement a Fahrenheit/Celsius temperature converter in both Java and JRuby that uses Java Swing as its GUI library. The source code can be found at http://is.gd/n3Je. (The Git repo main page for this project is at http://github.com/keithrbennett/multilanguage-swing. The README file has instructions for how to run the Java, Ruby, and Clojure versions.

Here is an image of the application’s sole window.  There are text fields for entering the temperature, and buttons and menu items to perform the conversions, clear the text fields, and exit the program.

The Fahrenheit  Celsius temperature conversion Swing app window

the temperature conversion Swing app window

(more…)

Read Full Post | Make a Comment ( 4 so far )

Applying User Interface Design to Source Code

Posted on November 28, 2008. Filed under: Uncategorized | Tags: |

The same user interface guidelines that make for an outstanding software product apply to source code as well. It turns out that programmers actually have human minds after all.

Without effective and efficient presentation, a product’s content and functionality can be missed and misunderstood. This principle applies way beyond the realm of software products. It also applies to traffic signals, automobiles, elevators, remote controls, exercise equipment, and airline cockpits, to name a few.

A good user interface designer understands and exploits the way the human mind perceives and learns. Good designs translate the essence of the product into a presentation that makes the best use of the toolset of the human mind.

Who, Me?

Amazingly, many software developers believe that we as a group somehow transcend the constraints and limitations of human perception, learning, and thought. According to them, that which is necessary for the common masses of “users” does not apply to us, for we are the high priesthood of software engineers, masters of the virtual universe.

(more…)

Read Full Post | Make a Comment ( 4 so far )

Next Entries »

Liked it here?
Why not try sites on the blogroll...