The Artima Developer Community
Sponsored Link

Java Buzz Forum
Stop (un)polluting my language!

0 replies on 1 page.

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 0 replies on 1 page
Carlos Villela

Posts: 116
Nickname: cvillela
Registered: Jun, 2003

Carlos Villela is a Java developer working mostly with web technologies and AOP.
Stop (un)polluting my language! Posted: Jun 26, 2003 6:47 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Carlos Villela.
Original Post: Stop (un)polluting my language!
Feed Title: That's sooo '82!
Feed URL: http://www.jroller.com/rss/cv?catname=Technical
Feed Description: Carlos Villela's weblog. Everyday life, everyday software development, everyday musings.
Latest Java Buzz Posts
Latest Java Buzz Posts by Carlos Villela
Latest Posts From That's sooo '82!

Advertisement
One of the most interesting things about Java is that developers take things personally when someone trashes it. Take some time to look at all those "Java is slow" or "Java is crap" posts at Slashdot. I find them very amusing - the replies are often somewhat intelligent, and often offer good substance and facts.

But that's not what I want to talk about in this post. I want to talk about the other side of this: when the 1.5 features and language changes started do be announced, the Java community got divided into three main categories: those who like the changes, those who don't, and those who won't spend their time fighting others about the m. Personally, I'm on the "stop polluting my language" front, and I found that most of the new language features are either good but not that needed, or something that's just being thrown in the language for it to look good on "Java versus C#" feature matrix comparisions.

I strongly feel that Java is starting to become something evolved, not designed. Its age is starting to show. If you take a look at some '97 code, you'll see lots of Vectors, Hashtables and Enumerations hanging around. If you look at '01 code, it has lots of getters/setters, Lists, HashMaps. In '02 code, you can see usage of JavaDoc attributes to define meta-data (XDoclet, QDox, etc), and lots of XML parsing routines. So, what the future holds for our everyday Java? Lots of genericized collections, funky iterations, metadata and declarative programming everywhere? Methods with varargs (the dreaded printf() syntax) and almost no typecasts?

Joshua Bloch gave two talks about this at thursday's BOF sessions at JavaOne. One of the BOFs was about metadata facilities in the upcoming release, and the other was about how the language features are going to change our so dear Java API.

First, the metadata stuff. I think few of you have seen the syntax proposed, as the draft spec is not out yet, so here's a sample:

@RequestForEnhancement(id=18230, author="Carlos Villela", summary="Refactor unused methods")
public class Foo extends Bar implements FooBar {
  public @Transaction void doStuff() {
   //...
  }
}

At a first glance, this looks awful to lots of people. But, in fact, it's an interesting change to the syntax:

CLASS_DECLARATION:
 [
  [CLASS_MODIFIER] ||
  ['@' TYPE_NAME ['(' ASSIGNMENT* ')']?]*
 ]*

METHOD_DECLARATION:
 [
  [METHOD_MODIFIER] ||
  ['@' TYPE_NAME ['(' ASSIGNMENT* ')']?]*
 ]*

FIELD_DECLARATION:
 [
  [FIELD_MODIFIER] ||
  ['@' TYPE_NAME ['(' ASSIGNMENT* ')']?]*
 ]*

CLASS_MODIFIER:
 'public'
 'protected'
 'private'
 'abstract'
 'final'

METHOD_MODIFIER:
 'public'
 'protected'
 'private'
 'abstract'
 'final'
 'strictfp'
 'synchronized'
 'transient'
 'native'
 'static'

FIELD_MODIFIER:
 'public'
 'protected'
 'private'
 'final'
 'strictfp'
 'transient'
 'static'

Joshua explictly said that if metadata definition was there since Java's day 1, we probably wouldn't have 'strictfp', 'synchronized' or 'transient' keywords, as they're only used at runtime to determine a specific semantic for the method/field being accessed. Indeed, very interesting, but why not make this change now? Why can't we deprecate a keyword and suggest the use of the attribute instead?

This way, instead of polluting the language with even more syntax, we're removing keywords in order to promote a more generalistic approach, that is, IMHO, much better. Joshua also said that they're not adding new keywords anytime soon, and I think that's fair enough - if they at least put "adding new keywords" in the same category as "adding new symbols".

Tiger comes with A LOT of new symbols, or new meaning for some symbols: now < and > mean different things when used with generic types. '.' means different things if used with varargs ('...' means 'this is a variable-length array of parameters'). ':' now can be used in the enhanced for loop (it was used before in labels), and so on.

What do you think about this? Leave a comment :)

Read: Stop (un)polluting my language!

Topic: Humble Beginnings Previous Topic   Next Topic Topic: What Would You Ask James Gosling?

Sponsored Links



Google
  Web Artima.com   

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