Jython v.s. Groovy

August 31, 2008 § 4 Comments

A commenter reminds me on Groovy (It was mentioned as part of Grails). His comment makes me curious on what’s the latest on Groovy and how it is stacking up to Jython.

Groovy’s differences vs Python is subtle. In fact, Groovy is way more similar to Ruby.

Couple of Groovy Syntax that looks like Ruby:

  • Groovy: d.collect { k, v -> k+1 }  
    • Ruby: d.collect {|k,v| k + 1 }
  • Groovy: rng = 1..3    
    • Ruby: rng = 1..3
  • Groovy: (1..3).each { i -> println i }   
    • Ruby: [1..3].each { |x| print x }
  • Groovy: def function_name(x) { return x; }  
    • Ruby: def function_name(x); return x end

Both Groovy and Jython do very good job in minimizing JAVA’s complexity. Groovy is more familiar to JAVA programmer than Jython but not by much since its syntax is Ruby-ish.

Now, next question is: Can I use existing JAVA packages from inside Groovy or Jython?

  • Groovy import statement is similar to JAVA. That’s how it can access other JAVA packages.
  • Jython access other JAVA packages via Python import statement (e.g. from java.util import Random) while also having access to Python standard packages (e.g. sys or os).

Comparing Groovy vs Jython is like comparing Ruby vs Python. Both are easy to read and comfortable to programmers. 

Using either one is a time-saver when developing in JAVA. Definitely use either one if you are dynamic language kind-of-guy and forced to develop in JAVA.

 

Quick Facts on Groovy:

  • It’s a dynamic language written on top of JVM (JAVA is a compile to byte-code language, just like CPython).
  • Its syntax is indeed very similar to Python and Ruby.
  • It has GroovyConsole.
  • It was created around 2003-2004.
  • It was created to overcome JAVA’s overly verbose syntax.

Quick Facts on Jython:

  • It’s Python implemented on top of JVM.
  • Jython is compiled to JAVA byte-code level.
  • It has Python Interpreter Console.
  • Jython release number is consistent with CPython release number (The latest stable is 2.2).
  • Because the latest stable is 2.2, Jython does not support Python’s decorator.
  • It was created in 1997.
  • It was created to overcome JAVA’s overly verbose syntax.
Installing Jython:
  • Download
  • Run this command: java -jar jython_installer-2.2.1.jar
Installing Groovy:
UPDATE (09/03/2008):
Interesting that a number of people pointed out how I write JAVA. What’s wrong with writing JAVA? I supposed I could search and replace it into Java/java. Mentally I like to make a distinction between java language vs the coffee or the island, because java logo is all caps. Am I missing out something? does JAVA stands for something?
 
References:

APE – Actionscript Physics Engine

August 31, 2008 § 1 Comment

APE is open source 2D physics engine for Flash or Flex. Written by Alex Cove.

Demo:

Crab demo 

Resources:

99 Bottles of Beer

August 20, 2008 § 1 Comment

99 Bottles of Beer site is an archive of 1 program, re-implemented in 1214 languages. The program is to sing 99 bottles of beer.

I’ll give you guys some of the popular ones:

Resource:

Windows WTF

August 20, 2008 § Leave a comment

Take a look at this. Taken from the dailywtf.com

Windows Error

Yet Another Web Framework: cgi_app

August 18, 2008 § Leave a comment

This is one old framework, but nonetheless still useful.

cgi_app is a python port of CGI::Application Perl module.

If it’s a low tech CGI based framework, what’s so awesome about it?

cgi_app is useful for building a quick, personal use app. It’s simple, widely supported (it use CGI. Duh… ), and it doesn’t do any magic behind your back.

Resources:

cgi_app main page

CGI::Application page

Games: Pro Evolution Soccer 2008 Wii

August 17, 2008 § 2 Comments

Disclaimer:

I love Winning Eleven/Pro Evolution series for the longest time, since PS 1 era. It just felt more realistic than FIFA series.

That being said, soccer games are not the most innovative thing. Year after year, nothing much has changed (with the exception of rosters and graphic quality).

Pro Evolution Soccer 2008 for Wii changed all that. It brings originality and set new standard for future soccer games for sure. Take a look at the following demo, and see it for yourself.

My favorite:

With the Wiimote, it’s possible to control ALL players, not just the one holding the ball.

Python vs LISP

August 9, 2008 § 1 Comment

Here are couple of interesting links:

Reddit

August 9, 2008 § Leave a comment

I am not aware at all that Reddit has been rewritten in Python. The python version spawned a web framework called web.py and is open sourced.

The original was written in LISP.

This is old story, but hopefully still entertaining.

References:

Original Desktop Interface: Bumptop

August 9, 2008 § Leave a comment

I don’t know about how useful Bumptop user interface is, but for sure it’s cool looking.

From their forum, it seems like Bumptop only works on Windows.

References:

Python Module: Boto

August 7, 2008 § Leave a comment

In short, Boto is a comprehensive API for Amazon Web Services.

It covers:

  • S3
  • EC2
  • Simple DB
  • Mechanical Turk
  • Simple Queue Service

Below is my personal opinions about Boto:

  • The SDB API is very pythonic, easy to understand and easy to use.
  • The SDB API supports multi-threading query calls, very nice.
  • Variable names between SDB and S3 aren’t very consistent, as if it was written by 2 different people. But that’s just syntactical  issue.

Reference:

Boto main site

Where Am I?

You are currently viewing the archives for August, 2008 at RAPD.

Follow

Get every new post delivered to your Inbox.