“Groovy’s concise syntax frees developers from typical Java constructs that are required for code compilation but don’t facilitate expressing what a program is really trying to accomplish. In this revival of the Practically Groovy series, Groovy developer and guest columnist J. Scott Hickey walks you through a series of comparisons between normal Java code and the same Groovy code to show you how this exciting language frees you to focus on the important aspects of coding.”
grovy is a scripting language, it is expected to be less verbose. However, author is full of crap because he deliberately writes the java code more verbose.
Such as:
Iterator iter = rentaBike.getBikes().iterator();
while(iter.hasNext()) {
Bike bike = (Bike)iter.next();
System.out.println(bike.toString());
}
code can easily be
for(Bike bike: rentaBike.getBikes())
System.out.println(bike);
}
I second that. That is one serious piece of crap article.
Woah, I didn’t know you could do that. Is that in Java1.4 ? That’s pretty nifty…
Java 5, which is out for 2 years. List had to be defined as List<Bike> tough.
Edited 2006-09-22 01:11
Ah ye see, I learned Java in college (I just graduated there) so I started learning it with 1.4. IBM still uses 1.4 in its products (I know, that’s where I work!).
author uses empty constructors when not needed, Also if groovy properties are not private as in the example, you can do the same for Java so getter and setters would be eliminated. This is just like some python dudes trying to claim python is better because you write hello world in one line.
Edited 2006-09-21 17:38
In recent years, the java community has arguably been developing in wrong directions.
I’ve been programming java professionally for about 5 years, and I’ve seen both good and bad approaches in large-scale application development. Nowadays, developers are competing to include more open-source frameworks and libraries, when old, classic J2EE/Java is more than sufficient for the task at hand. Misuses of Hibernate and Spring are common, and not to mention uses of Maven. The result is often overly complex applications, build breakages and projects running way over estimates. In my opinion, these frameworks should often be avoided to reduce complexity, making it easier for someone new to the project to get the overview and easily build the project.
It should not be neccessary to be an expert in Hibernate, spring, EJB3.0, Maven to contribute to even the simplest projects.
So, my point is Groovy is probably nice, but it’s something new and unknow to most developers – and doesn’t really bring much to the table. Definitely not enough to justify the extra hassle and learing effort for everyone involved