Wednesday, January 10, 2007

Java 7 aka Groovy 1.0

Just a short post this time, as i'm a bit sleepy this evening.

It seems like a lot of blogs lately have been mentioning some of the features proposed for jdk 7. Admittedly, I'm only going on blog headlines plus a small bit of reading on the blogs..so i might be making some wrong assumptions.

The 2 points i have read about the most..the property operator and null handling..both of these are already in Groovy. I know Groovy got some of these ideas from other languages, and java is trying to adopt some dynamic features to keep developers interested in java.

I'll admit i've been reading Groovy in Action (so my groovy knowledge is still theoretical), and i'm pretty excited about trying to learn Groovy well enough to begin using in my projects. I would think any java fan would find lots to like in Groovy, if they can forget about the early hype and examine groovy with an open mind.

Anyway..it seems funny that jdk is trying to adopt some ideas that are already done better in Groovy. I like that Groovy overloads the . (dot) operator for property access, instead of creating a new -> operator. I believe both can generate the accessor methods for you, if you desire.

I also like Groovy's safe null check, using the ?

In Groovy to prevent null pointers, you would so something like obj1?.obj2?.someMethod

In java 7 proposal it look like this in java:
obj1#getObj2()#getSomething()

In both cases discussed here (property access and null handling)..i like the present Groovy solution over the current java 7 proposal.

I wonder how many more future java 7 proposals will mimic Groovy functionality?

16 Comments:

At 8:45 AM, Blogger Andy said...

So why can't the Groovy JSR be rolled in to Java 7? JDK7 could then have Rhino and Groovy as scripting options. Or is JDK7 going to make the same kind of mistake as JDK1.4 did with logging and give some watered down solution that's just "good enough"?

 
At 10:24 AM, Blogger Jeff C said...

Andy,

I think most people would prefer that Groovy not be rolled into the jdk, because then new Groovy releases would be tied to new jdk releases. (i.e. the release schedules would have to be the same, i guess)

 
At 1:12 PM, Anonymous Anonymous said...

grovvy is good for some things, but productivity gains are as usual greately exaggerated. it is not really magic hammer. two big killers: tool support, and performance royally sucks. still i would prefer it to ruby of course.

 
At 3:46 PM, Blogger Daniel Serodio said...

I agree with andy wrt JDK logging, they should have adopted log4j instead of reinveinting it (poorly).

But I don't think that Groovy should be rolled into the JDK. Java should be "pure OO" and statically typed, and, and Groovy it's "functional-friendly", dynamic cousin.

Sun should sponsor Groovy and add dynamic language features to the JVM, not the Java language. Featuritis is killing Java... :-(

 
At 4:00 PM, Blogger Jeff C said...

I agree with Daniel.

Groovy shouldnt be added to the jdk..but it would be nice if some hooks were added to the jvm that would allow dynamic languages like Groovy to perform closer to the speed of java.

 
At 6:32 PM, Anonymous Stephen Colebourne said...

On JavaLobby I suggested adding new syntax to Java to allow embedded Groovy code within a Java method:

public void doStuff() {
Person person = ...;
FormBean input = ...;
groovy {
// write any valid Groovy code here
person.surname = input.surname;
}
}

The Groovy code would (optionally) be compiled at the same time as javac compiles the rest of the Java class, and the bytecode would be directly inserted into the Java code. The Groovy code would also have full access to the surrounding Java state - person and input in the example.

Well, its a thought anyway...

 
At 9:56 PM, Blogger Andy said...

Jeff & Daniel,

Point well taken. Hadn't thought about how tightly coupled they would become.

Daniel is right, but I think Sun ought to be looking at 2 things: supporting more languages on the JVM rather than making Java (the language) more like those other languages and improving the core class libraries.

Unless I'm really missing the point, doesn't Java already have closures in the form of Anonymous Inner Classes? Sure, it's verbose but it feels more, well, OO. They're statically typed too which leaves no doubt of what they're supposed to do and how they're expected to behave. Groovy (and Beanshell--my old favorite from a long time back) does closures already. Leave it at that; Groovy (and Beanshell) won that one. If someone wants to use closures badly enough, then use aic or a scripting language.

As for my second point, the concurrency packages introduced in 1.5 were a major improvement. Swing is a major improvement in 1.6 in both performance and look and feel. These are among a few of the improvements made to the libraries over the last 2 releases.

There are still other things that need to be fixed. For example, start removing Depricated API (seriously, it's time to get rid of some stuff). Depricate Properties and start over with somthing that doesn't extend Hashtable. Get tighter integration with the desktop. I could go on and on but I think we all get it.

Don't get me wrong. I think Java ought to have features added to it as time goes forward. But I also think that features should be added sensibly.

 
At 2:46 AM, Anonymous Anonymous said...

網頁設計,網頁設計公司,最新消息,訪客留言,網站導覽
情趣用品,情趣用品,情趣用品
色情遊戲,寄情築園小遊戲,情色文學,一葉情貼圖片區,情人視訊網,辣妹視訊,情色交友,成人論壇,情色論壇,愛情公寓,情色,舊情人,情色貼圖,色情聊天室,色情小說,做愛,做愛影片,性愛

免費視訊聊天室,aio交友愛情館,愛情公寓,一葉情貼圖片區,情色貼圖,情色文學,色情聊天室,情色小說,情色電影,情色論壇,成人論壇,辣妹視訊,視訊聊天室,情色視訊,免費視訊,免費視訊聊天,視訊交友網,視訊聊天室,視訊美女,視訊交友,視訊交友90739,UT聊天室,聊天室,豆豆聊天室,尋夢園聊天室,聊天室尋夢園,080聊天室,080苗栗人聊天室,女同志聊天室,上班族聊天室,小高聊天室
AV,AV女優
視訊,影音視訊聊天室,視訊交友
視訊,影音視訊聊天室,視訊聊天室,視訊交友,視訊聊天,視訊美女,視訊辣妹,免費視訊聊天室
自慰器,自慰器

 
At 2:39 AM, Blogger 琪琪 said...

we have the highest quality but the lowest price fashion products wholesale from China.Here are the most popular China Wholesale products for all of you.You can visit
...................................................................

 
At 3:27 AM, Blogger 琪琪 said...

And if we are talking specifics, here, then make it a waist 33, length 30 to crease nicely over my square tipped Kenneth Cole Reaction vintage nubuck loafers. I also would like a 1.8" wide Gucci horsebit ring buckle belt the same color as the loafers.

............................................................................

 
At 3:28 AM, Blogger 琪琪 said...

Enjoy your shopping experience on mensclothingus.com.You can find the father who desire fashionable, intellectual mens clothing simultaneouslyGod bless you!I really agree with your opinions.
..............................................................

 
At 10:49 PM, Blogger 酒店上班請找艾葳 said...

艾葳酒店經紀提供專業的酒店經紀,酒店上班,酒店打工、兼職、酒店相關知識等酒店相關產業服務,想加入這行業的水水們請找專業又有保障的艾葳酒店經紀公司!
艾葳酒店經紀是合法的公司、我們是不會跟水水簽任何的合約 ( 請放心 ),我們是不會強押水水辛苦工作的薪水,我們絕對不會對任何人公開水水的資料、工作環境高雅時尚,無業績壓力,無脫秀無喝酒壓力,高層次會員制客源,工作輕鬆。
一般的酒店經紀只會在水水們第一次上班和領薪水時出現而已,對水水們的上班安全一點保障都沒有!艾葳酒店經紀公司的水水們上班時全程媽咪作陪,不需擔心!只提供最優質的酒店上班環境、上班條件給水水們。

 
At 5:26 PM, Blogger milf said...

find air beds in wisconsinbest air beds in wisconsincloud air beds

best cloud inflatable air bedssealy air beds portableportables air bedsrv luggage racksaluminum made rv luggage racksair bed raisedbest form raised air bedsbed air informercialsbest informercials bed airmattress sized air beds

bestair bed mattress antique doorknobsantique doorknob identification tipsdvd player troubleshootingtroubleshooting with the dvd playerflat panel television lcd vs plasmaflat panel lcd television versus plasma pic the bestadjustable bed air foam The best bed air foam

hoof prints antique equestrian printsantique hoof prints equestrian printsBuy air bedadjustablebuy the best adjustable air bedsair beds canadian storesCanadian stores for air beds

migraine causemigraine treatments floridaflorida headache clinicdrying dessicantair drying dessicant

 
At 5:27 PM, Blogger milf said...

black mold exposureblack mold symptoms of exposurewrought iron garden gatesiron garden gates find them herefine thin hair hairstylessearch hair styles for fine thin hairnight vision binocularsbuy night vision binocularslipitor reactionslipitor allergic reactionsluxury beach resort in the philippines

afordable beach resorts in the philippineshomeopathy for eczema.baby eczema.save big with great mineral makeup bargainsmineral makeup wholesalersprodam iphone Apple prodam iphone prahacect iphone manualmanual for P 168 iphonefero 52 binocularsnight vision Fero 52 binocularsThe best night vision binoculars here

night vision binoculars bargainsfree photo albums computer programsfree software to make photo albumsfree tax formsprintable tax forms for free craftmatic air bedcraftmatic air bed adjustable info hereboyd air bedboyd night air bed lowest price

 
At 5:27 PM, Blogger milf said...

new houston house houston house txstains removal dyestains removal clothesstains removalteeth whiteningteeth whiteningbright teeth

jennifer grey nosejennifer nose jobscalebrities nose jobsWomen with Big NosesWomen hairstylesBig Nose Women, hairstyles

 
At 5:27 PM, Blogger milf said...

dessicant air dryerpediatric asthmaasthma specialistasthma children specialistcarpet cleaning dallas txcarpet cleaners dallascarpet cleaning dallas

vero beach vacationvero beach vacationsbeach vacation homes veroms beach vacationsms beach vacationms beach condosmaui beach vacationmaui beach vacationsmaui beach clubbeach vacationsyour beach vacationscheap beach vacations

bob hairstylebob haircutsbob layeredpob hairstylebobbedclassic bobCare for Curly HairTips for Curly Haircurly hair12r 22.5 best pricetires truck bustires 12r 22.5

washington new housenew house houstonnew house san antonionew house ventura

 

Post a Comment

Links to this post:

Create a Link

<< Home