The Artima Developer Community
Sponsored Link

Weblogs Forum
Will Closures Make Java Less Verbose?

70 replies on 5 pages. Most recent reply: Apr 10, 2008 9:09 AM by Mark Thornton

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 70 replies on 5 pages [ « | 1 ... 2 3 4 5 ]
peter kovac

Posts: 8
Nickname: pk11
Registered: Apr, 2008

Re: Will Closures Make Java Less Verbose? Posted: Apr 7, 2008 10:44 AM
Reply to this message Reply
Advertisement
Hi,

Nothing stops anybody from creating j3k, jdk is open sourced for a reason. there are various forks in python as well: parallel python, stackless etc.

Saying that we should not add new big features to java because it's impossible to add these without potentially killing the platform due to complexity is weird, especially if you are suggesting instead to leave it as is (i am referring to bruce's last comment here).

I mean what would happen if java was officially frozen? people would leave as quickly as possible. i would rather give it a chance and try to fix it, even if the fixes are not everybody's cup of tea. the language *must* evolve otherwise it will be COBOL soon (and what's worse: without even trying!).

My wish-list for java 7:
- upgraded closure support [since all I would like to see is simpler callbacks and ARM any of the existing proposals(cice,fcm,bgga) would work for me but if i had to pick one i would go "all the way"]
- java bean property support
- join-fork framework
- type inference
- super packages

And by the way there is a really simple way to avoid changes: just do not upgrade! but let's add new features to java for us who would like to have them!



Posts: 55
Nickname: lazydaze
Registered: Feb, 2006

Re: Will Closures Make Java Less Verbose? Posted: Apr 7, 2008 2:28 PM
Reply to this message Reply
I bet that 10 years ago there were people saying that COBOL *must* evolve. I'm just glad there were enough people around who could appreciate the virtues of switching to a new language like Java. If there weren't, perhaps we'd be coding in Object Oriented COBOL today, and debating closures for COBOL. Sometimes it's good to move on to another language. Even if Java (the language, not the JVM or libraries) was frozen now, I'd guess that its popularity would stay strong for quite a while yet.

peter kovac

Posts: 8
Nickname: pk11
Registered: Apr, 2008

Re: Will Closures Make Java Less Verbose? Posted: Apr 7, 2008 4:12 PM
Reply to this message Reply
hi dave,

it's not like i am in love with java nowadays (personally i wait till 7 and if that release is not progressive enough i switch our stable layer to scala). but what i do not understand is if you plan to leave (or already have left) java behind, what difference does it make to you if closures got added or not?

peter kovac

Posts: 8
Nickname: pk11
Registered: Apr, 2008

Re: Will Closures Make Java Less Verbose? Posted: Apr 8, 2008 6:54 AM
Reply to this message Reply
hi dave,

i think this post makes a good point:

"I've often thought that software developers were akin to Magpies: birds who are notorious for stealing shiny items to decorate their complex nests. Like Magpies, software developers are unusually smart and curious creatures, almost by definition. But we are too easily distracted by shiny new toys and playthings."

http://www.codinghorror.com/blog/archives/000916.html

I feel the same way sometimes when i want closures in java or thinking about switching to scala.



Posts: 55
Nickname: lazydaze
Registered: Feb, 2006

Re: Will Closures Make Java Less Verbose? Posted: Apr 8, 2008 7:12 AM
Reply to this message Reply
Hi Peter,

I do still code in Java. I'm just questioning the wisdom of developing a language forever. At some point, adding features will start to degrade the language rather than enhance it.

Mark Thornton

Posts: 275
Nickname: mthornton
Registered: Oct, 2005

Re: Will Closures Make Java Less Verbose? Posted: Apr 8, 2008 7:24 AM
Reply to this message Reply
> Hi Peter,
>
> I do still code in Java. I'm just questioning the wisdom
> of developing a language forever. At some point, adding
> features will start to degrade the language rather than
> enhance it.

Nevertheless some additions could simply use of the language. Allowing primitives in (reified) generics would remove existing restrictions. Reified generics would also remove some of the curious behaviour of erased generics, then (hopefully) at some later date erasure could be removed altogether.

Carson Gross

Posts: 153
Nickname: cgross
Registered: Oct, 2006

Re: Will Closures Make Java Less Verbose? Posted: Apr 8, 2008 9:35 AM
Reply to this message Reply
I feel the same way sometimes when i want closures in java or thinking about switching to scala.

I sympathize Peter. But well done and properly used closures can really lead to a 5-10x LOC savings and an increase in code clarity. I've seen it internally in our code base.

There is no silver bullet in software engineering, and the rah-rah blog guys are often full of s**t, but this is a useful tool if it is done well, with good taste.

As I've made clear, I remain pessimistic.

Cheers,
Carson

peter kovac

Posts: 8
Nickname: pk11
Registered: Apr, 2008

Re: Will Closures Make Java Less Verbose? Posted: Apr 8, 2008 9:54 AM
Reply to this message Reply
Hi Carson,

What do you mean by this?
> I've seen it internally in our code base.

You mean you switched to scala, or you are using a closure prototype internally?

Thanks

peter kovac

Posts: 8
Nickname: pk11
Registered: Apr, 2008

Re: Will Closures Make Java Less Verbose? Posted: Apr 8, 2008 9:59 AM
Reply to this message Reply
ops, just found your earlier comment.

Humberto Madeira

Posts: 5
Nickname: kunakida
Registered: Apr, 2008

Re: Will Closures Make Java Less Verbose? Posted: Apr 10, 2008 8:57 AM
Reply to this message Reply
"His point is that Java has gone so overboard into "everything is an object" that it prevents simple and clear expressions of ideas. "

OTOH Javascript is messed up with its support for closures too. Closures in Javascript are used to fake up private attributes and methods, but when overused by newbies it makes a mess of garbage collection (specially on MSIE, where it leads to rampant memory leaks). And using in-place definitions of closures makes the code look like utter heck.

Rather than closures, it would be better to give Java the ability to refer to a function directly (as Javascript and C++ do) without having to use a string for lookup, or requiring a runtime check with a possible throw of an exception (compile time checking is much better for this).

eg.
Method aMethod = MyClass.myMethod;

"We might have come to the conclusion that backward compatibility is being maintained primarily to serve companies that have no intention of upgrading to newer versions of Java anyway."

Actually, the reason I maintain backward compatibility is because

1) I can (Java fortunately allows this, and if they didn't - I would be looking elsewhere)

2) I didn't like the introduction of templates in C++ and I don't like them in Java 1.5+ either (they are an ill-considered hack to get around the problem of primitive variables - they also make the code look like heck) Coding in Java 1.4 guarantees I avoid all templates.

3) from a business point of view, not all OS'es may yet have ported the later versions of Java yet (e.g. mainframe OS'es are usually consistently behind) and older, unsupported OS'es may not have ports of later Java versions (e.g. the old WinNT box that I can't upgrade, but still has the power to be used as a developer station) If I want to hit the absolutely largest market, coding to the lowest version I can use is better for me (remember the "write once - run anywhere" promise?)

4) Java 1.4.2 is already good enough for most development.
It doesn't need to be "improved" with a lot of additional bloat. Language developers really need to learn when to stop adding stuff just for the sake of adding stuff.

If Sun seriously wants to give developers a reason to "upgrade", then they should instead spend the bulk of their time rethinking their thoroughly ill-conceived Swing UI framework and replace it with something a little closer to SWT (but more cross-platform).

Why is it that developing a UI for a Java application has to be so messy and complicated, and produce such unappealing results? (only marginally mitigated by bringing in a Swing guru) Most companies I've been in usually give their UI work to newbies - and that mess is what their customers will see.

Why do you think WebUI's took off so quickly with Java, while MFC resisted it for much longer?

Mark Thornton

Posts: 275
Nickname: mthornton
Registered: Oct, 2005

Re: Will Closures Make Java Less Verbose? Posted: Apr 10, 2008 9:09 AM
Reply to this message Reply
> Most companies I've been in
> usually give their UI work to newbies - and that mess is
> what their customers will see.

I think this is a mistake in any language/environment. Producing a good UI is not a trivial task.

Flat View: This topic has 70 replies on 5 pages [ « | 2  3  4  5 ]
Topic: Will Closures Make Java Less Verbose? Previous Topic   Next Topic Topic: Refactoring addicts and dynamic languages

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use