Friday, August 14, 2009

Web applications Vs. Desktop Applications

I do not normally make a habit of writing about other blogs or stories that I have read, but this is something that I could not ignore. There is turf war going on between traditional programmers and Web programmers, and it's time to put an end to it!

This all started with a highly contested blog entry byMichael Barude, which was quickly followed up by Jeff Atwood. They both had some pretty heated things to say about the other's chosen medium. I'll save you some time and give you the best lines from each:

Michael
The reason most people want to program for the web is that they’re not smart enough to do anything else
Jeff
You hope everything doesn't "move to the web"? Wake the hell up! It's already happened!
In order to put this cat fight to bed, I propose the following:

1) Each side must realize that there is terrible code written every day, both on the Web and on the Desktop.

2) There are groundbreaking and terriffic apps written every day (most of them never get any attention) and they come in Web based applications as well as desktop applications.

3) The majority of programmers are not very good (I include myself in this. If you say that you haven't written bad code, you have either never written code or you are a liar).

4) You can not blame the medium for the work of the artist!

Saying that someone isn't smart or sterotyping users of a particular medium is bad form! No matter who you work for (Michael) or how popular you are(Jeff)! Jimmy Page isn't dumb because he chose to play the Electric guitar in a rock band, instead of being a concert pianist (in fact, most would say he was smarter for his choice). Programming is an art form (no matter what everyone else believes). Just like every form of art, there is going to be a million bad artists for every great one. I think that I agree with Joshuua Nunn :
if you dismiss web apps, you dismiss a lot of clever, well written programs right out of the gate.
I also think that there is still a very bright future for desktop apps as well. As it stands now, there is no Web Office System that even comes close to comparing to Open Office, let alone Microsoft Office. There are always going to be ERP Systems and other Business Development Tools that will need to be installable on the Desktop.

There will always be a need for great code that solves a problem and/or provides a service. The average user doesn't care if it is on the Web or on thier desktop. They just want it to work and be useable.

We, the artists, are the only one's arguing about this!


Thursday, August 6, 2009

Feelin' Groovy

For the last six months or so, I have been spending some quality time with Groovy. For those of you who may not already know, Groovy is awesome! Groovy is a programming language that is an extension of the Java Platform. It is a scripting language that is similar to Ruby. Groovy uses a lot of the standard Java syntax and since it compiles down to Java bytecode, it can be used in any Java project and can supplement any Java applications that you may be working on. Groovy has been around, in one form or another, since it was created by James Strachan in August of 2003. Since then it has become part of the java standard (JSR 241).

The JSR describes Groovy’s place in the Java world as:

Currently the Java community does not have a standard JCP-sanctioned agile programming language for writing scripts and applications that interoperate with the entire J2SE platform.

Groovy makes writing scripts and applications for the Java Virtual Machine fast and easy. Groovy includes language features found in Python, Ruby, and Smalltalk, but uses syntax natural to developers that use the Java programming language. Because Groovy is based on J2SE, applications written in Groovy can use the full complement of J2SE APIs, and work seamlessly with other packages and applications written in the Java programming language

Groovy is a dynamically typed language that is not compiled until runtime. It's this reason that many Java developers use Groovy to build prototypes of thier programs. This speeds up development and because Groovy is a part of the JVM, it can easily be translated into Java. You don't even have to translate the Groovy code. You could just utilize it as part of a Java project:

Now there is even a project called Groovy Runner that will let you run any Groovy file on an Apache server the same as you would PHP. This lets you avoid the Java Web server all together!

The downside thus far has been the difficulty rating in Eclipse. I love Eclipse but using the Groovy plug in is buggy at best. However, you can save a lot of time over the life of a project, by using Groovy. Just something as simple as adding two random numbers together takes 50% less work and lies of code:

Java Example:

import java.util.Random;


public class AdditionFlash{

public static void main (String args[]) {

Random rnd = new Random();
int[] numbers = {0,1,2,3,4,5,6,7,8,9};
int random1 = rnd.nextInt(numbers.length);
int random2 = rnd.nextInt(numbers.length);
int addNums = random1 + random2;

System.out.println(" " + random1);
System.out.println("+ " + random2);
System.out.println("_____");
System.out.print(" " + addNums);

}//end main
}//end class


Groovy Example:

import java.util.Random;

def list = [0,1,2,3,4,5,6,7,8,9]

random = new Random()
random1 = random.nextInt(list.size)
random2 = random.nextInt(list.size)
addNums = random1 + random2

println " " + random1
println "+ " + random2
println "_____"
println " " + addNums

As you can see most of the boilerplate code that is commonplace in Java is unnecessary with Groovy. If you want to save time on your next Java project, perhaps you should give Groovy a try! There are plenty of resources to help you get started with Groovy, such as Groovy Podcasts, Groovy Books, Groovy Zone, and Groovy Overflow.