How Java supposed to look like on OS X

March 30, 2009 § Leave a comment

Quaqua is open source UI java library for OS X. Subjectively, IMO, it looks better than Swing and feels native on OS X.

Reference:

Quaqua project page

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:

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:

Fotolog Backend

February 2, 2008 § Leave a comment

Hadoop: Open Source Map Reduce

December 29, 2007 § 2 Comments

What is Map:

In Python, map() applies a certain function to each element in a list. Map returns a list.

What is Reduce:

Superficially, not much difference, reduce() takes a certain function and runs that function against every element in a list. Reduce returns 1 item.

What is MapReduce:

It is an architecture that allows functions to be executed across distributed cluster. MapReduce is special because the map and reduce functions are complemented with key-value mapping so that functions can be executed across distributed commodity servers.

What is Hadoop:

It is MapReduce open source implementation. It is written in Java.

Python obviously already have map and reduce functions, so what’s left is to figure out the distributed aspect of MapReduce. Below are two people who have already thought of MapReduce implementation in Python:

Resources:

Fun with search engines: RoR vs Django vs cakePHP vs cherrypy vs J2EE

December 22, 2007 § 4 Comments

Below are the results of comparing RoR, Django, cakePHP, CherryPy, and J2EE:

  1. Google Trends: Notice the sliding decline of J2EE
  2. Sucks-Rocks.com: Notice that J2EE receives 2.6 as of today
This comparison is definitely “just for fun”, but somewhat reflecting my general sentiment towards Java.
More importantly, CherryPy is rocking real hard! Its simplicity is way beyond anything else I have ever seen:
  1. Install Python
  2. Install CherryPy
  3. Make Web Application. That simple!
  4. Optional, if you need database, slap SQLAlchemy as the model layer.

 Luckily, based on this 1 information below, job growth in awesome languages is increasing.

ruby, python, perl, java, php Job Trends graph

Extra Info:

Java is dead on Google Search

December 21, 2007 § 2 Comments

Fun articles I found when typing “Java is dead” on Google Search:

Old Internet Articles

November 22, 2007 § Leave a comment

I’d like to share these articles I found as nostalgic reads.

The list will grow as I found more interesting “relics”.

Some of my thought about Software Architecture

September 4, 2007 § Leave a comment

Upon various drinking occasions with fellow developers, there are a couple of wisdom worth sharing about software architecture. Enjoy…

Design Pattern:

Don’t do some of them because James Gosling said so. Don’t do some of them because the book said so. And more importantly, don’t do it because your blue suit client demand you to do so.

Use design pattern technique based on necessities and careful consideration about the feature’s purpose.

Don’t just use design pattern that you only know. Depending on the requirements, sometimes you just have to learn new design patterns. Better start learning now rather than never.

Polymorphisms:

Be very careful with it. Don’t over do it. Nobody wants to see 10M lines of stack trace.

Remember that the purpose of polymorphisms is to re-use parent object’s properties as much as possible. Extending excessively cause object’s behavior to keep changing throughout software’s life cycle.

Web Frameworks:

Which one is really good for you? Is the company you are working for a JAVA shop? Is the application that you build need Perl? The answer of this question depends on what skills you already have. Unless, if you make an application for the sake of learning something new.

CakePHP is awesome by the way, but that’s me being a zealot.

If you think a framework sucks, is it because the framework really suck? or is it because you don’t want to learn it? or it’s because the learning curve was huge? It is best to stay objective when reviewing or using a framework, you might miss some awesome features.

Ain’t nobody cares about your choice of framework, as long as it get the job done.

Scalability:

Scale what? How to scale it? It is very important to be able to identify which part of the application that needs to scale well.

Software/Jargon Zealotry:

Between friends, the zealotry is fun (i.e. OS X rulez, Windoze sux) but in professional setting, this is bad. Not because it would make you look “unprofessional”, but because it will clouds your judgment.

Not everything needs to be Service Oriented Architecture & definitely not everything needs to be AJAX.

Ruby on Rails may be cool, it is actually so totally cool, but the performance may varied (depending on the Gems and many other things).

Sometimes reading Slashdot too much makes you think that all of your choices sucks big time. For example, client-side development requires AJAX, or Flash, or Java Applet, or Browser plugin. All 4 of them suck big time in different categories. Maybe it’s best to just pick 1 and read more API.

I think Java sucks, and becoming suckier in every upcoming version but it is de facto standard for blue suit jobs. If I’m starving, I will code in Java.

Debunking Old Myth:

Just because Javascript/Flash used to sucked, it doesn’t mean that both will stay suck.

It is true that IE 7 is still suck, but try opening IE 6… you will realized that the world had become a better place. In addition, Firefox was and is still awesome but the memory usage is still brutal.

Scriptaculous was great, but there are others which is flat-out better now, i.e. Mootools or Mochikit. Why I said that Scriptaculous was great? Browser memory is precious and Scriptaculous is not really efficient, new Effect is always creating a new object as opposed to recycling existing Effect object.

Resource:

IBM – Best Practice for Web Developers

Gotapi.com: Finding documentation has never been so easy

September 2, 2007 § Leave a comment

For readers and all fellow developers: Finding documentation has become less of a pain. Thanks to Gotapi.

Currently they have:

  • HTML/CSS/Javascript. Too bad they don’t have MSDN Javascript.
  • Javascript UI libraries.
  • XML
  • C/C++ libraries.
  • PHP
  • Ruby on Rails
  • Python (Reading from blog.gotapi, Python is 1 of the first documentation)
  • Perl
  • Erlang
  • MySQL
  • and much more…

I highly recommend readers to go check Gotapi. RTFM has just gotten easier.

References:

Where Am I?

You are currently browsing the java category at RAPD.

Follow

Get every new post delivered to your Inbox.