This is actually a response to an article, "Is Java dying? Dependency injection and other Java necessary evils", written by my friend Juanfri. Like his article was a response to another article that turned out to be too large, mine started out that way as well. In the end I decided to just post it to my own blog (that way it at least gets some attention).
I must say I liked the original article, but in the end I don't agree with some of it's assertions.
I don't agree for example that there is anything wrong with GWT using overlay types. The code example is disingenuous because it solves a different problem. In fact I have written the same code (using simple-json) this weekend and it's completely similar:
The integration in Ruby is nicer and simpler? Sure, but the mapping provided by GWT sure is useful and the implementation is normally completely hidden from view.
The examples about dependency injection, and his efforts to create a DI framework for Ruby are really funny, especially because they are so recognizable, all of us in this business have gone through the same moments (and will probably still do so a couple of more times during the years that come). Encountering a new technology and then using it for absolutely everything that you come across is normal.
It is the reason almost everything in Java is configured with XML, it was just the way it was done some years ago and will probably still stay that way for some years more. But the whole drive to use annotations shows that people are looking for different ways (and making the same mistakes where suddenly everything uses annotations). And Guice is a prime example where configuration is done using code instead of configuration files. Of course, with the limitations of the Java syntax the result will be less "beautiful" than the same in some other languages.
And finally I also don't agree that there is a huge movement to dynamically typed languages. Instead I would say there is a strong desire to find "The Next Big Thing", in this case "The Next Big Language".
I agree it probably has to do with the fact that Java is already with us for a long time and we have come to know its limitations, 15 years ago it was brilliant, today it's still nice but we know we can do much better.
And of course we know we can do better because there are several examples: C# is already somewhat better (but too similar, not revolutionary), dynamically typed languages like Groovy and Ruby have many advantages (but too messy and too much testing needed for my tastes), or functional languages like Haskell and Erlang that might become essential in the future where having large numbers of processors becomes the norm (but highly functional and therefore unknown to many programmers) and some that try to combine to best features of all like Scala.
Personally I don't really like dynamically typed languages for anything large. It's really cool to be able to work your way into the innards of any object in any way you like but real soon I feel the need to "formalize" in some way what I'm doing, some way of saying "I know what I'm doing, trust me" or even "this is the way to do it, don't try it some other way!".
At this moment I'm trying to learn Haskell and Scala because my "functional side" is really underdeveloped. Scala because it's not so much of a big step coming from Java and Haskell because I want some experience with a language that was made from a fully functional point of view from the beginning. The problem of course is that neither has yet attracted a huge following so I'm not really sure I'll ever be able to use any of them for work. But in the mean time at least I can enjoy learning something new and interesting.
In the end I think "The Next Big Language" doesn't exist yet, but it seems we're all, consciously or unconsciously, waiting for it.
Showing posts with label java. Show all posts
Showing posts with label java. Show all posts
Monday, June 21, 2010
Sunday, February 14, 2010
Switching between Java versions
Original post date: Fri Jun 01 12:00:00 2007
It was always possible of course to install several Java versions on the same system, but switching from one to another has always been a bit of a nuisance. In Windows I started using batch files that I wrote specifically for the purpose of setting PATH and JAVA_HOME variables while forLinux Fedora you can use the alternatives command.
But I just found out that newer Java versions actually support switching versions directly from the command line:
will require that the code is run with a VM of at least version 1.5 while:
will use any version 1.6 VM (so it won't accept 1.5 nor 1.7, but it will accept 1.6u1). Requiring a specific version of the VM is supported but is not recommended because it would tie you to that very VM not even allowing the use of VMs that have important bug or security fixes.Specifying a VM that can not be found on the system will result in an error of course:
It was always possible of course to install several Java versions on the same system, but switching from one to another has always been a bit of a nuisance. In Windows I started using batch files that I wrote specifically for the purpose of setting PATH and JAVA_HOME variables while for
But I just found out that newer Java versions actually support switching versions directly from the command line:
java -version:1.5+ ...
java -version:1.6* ...
> java -version:1.4* -version
Unable to locate JRE meeting specification "1.4*"
Java Games - Bang Howdy
Original post date: Sat Jan 13 12:00:00 2007
This has already been a Java Application of the Day but I thought Bang Howdy deserves to be mentioned more. This is one of those examples that it is very much possible to write nice games using Java!
This has already been a Java Application of the Day but I thought Bang Howdy deserves to be mentioned more. This is one of those examples that it is very much possible to write nice games using Java!
F3 and Flying Saucers
Taking a look at the latest information about that highly intriguing Java scripting language called F3 I found a reference to yet another interesting Java project I had not heard about before Flying Saucer. A strange name for a XHTML+CSS renderer but I'm not complaining, components like this are always very welcome!
Regular simplification
Original post date: Sun Nov 19 12:00:00 2006
Hey, I should do this more often! While writing the previous item I thought it would be nice to format the regular expression a bit by indenting it and adding some comment, this was the result:
And while setting this up I saw that this was actually more complicated than need be so I started pruning. When I put back the resulting expression everything still worked so I must have done something right. The indented version looks like this:
And the resulting expression looks like this:
A bit shorter than the first version but still way too cryptic in my book.
Hey, I should do this more often! While writing the previous item I thought it would be nice to format the regular expression a bit by indenting it and adding some comment, this was the result:
# gobble any spaces
(\s*)
# main group
(?:
# keyword - gather letters until first space or =
([^=\s]*)
# option group
(?:
# option 1 - attribute has no quotes
(?:
# gobble spaces and =
(\s*?=\s*?)
# value - gather anything that's not a space or quote
([^\s"]+)
)
|
# option 2 - attribute has quotes
(?:
# gobble spaces and =
(\s*?=\s*?)
# value - gather anything between two quotes
(".*?")
)
)?
)
# gobble any spaces
(\s*)
# keyword - gather letters until first space or =
([^=\s]*)
# optional group containing the value
(?:
# gobble spaces and =
(\s*?=\s*?)
# option group
(?:
# value - (option 1) gather anything that's not a space or quote
([^\s"]+)
|
# value - (option 2) gather anything between two quotes
(".*?")
)
)?
(\s*)([^=\s]*)(?:(?:(\s*?=\s*?)([^\s"]+))|(?:(\s*?=\s*?)(".*?")))?
Regular confusion
Original post date: Sun Nov 19 12:00:00 2006
I have been working the last couple of days on adding syntax highlighting to my blog. For this I used the jEdit syntax package that I found on SourceForge. I had to change it a bit because it was a bit too focused on using it from within an editor but all in all it is not bad.
Only the XML highlighting didn't really convince me, it would just color everything blue except for the comments. So I thought I'd take a stab at parsing the attributes so keys and values would get their own colors.
But looking at the code I realized it would take some work doing it the way they did it so I decided to just at a regular expression at right point.
Thing is, regular expressions are great but when they finally result in something like this, I have to wonder "WTF am I doing???":
And this is without the escaping that is necessary when putting this in a Java string! Luckily it's only a couple of slashes but it can soon get very messy.Oh, and what it does is figure out the attributes for an HTML or XML element. So if you have something like this:
the regular expression will cut it up into the following tokens:
I have been working the last couple of days on adding syntax highlighting to my blog. For this I used the jEdit syntax package that I found on SourceForge. I had to change it a bit because it was a bit too focused on using it from within an editor but all in all it is not bad.
Only the XML highlighting didn't really convince me, it would just color everything blue except for the comments. So I thought I'd take a stab at parsing the attributes so keys and values would get their own colors.
But looking at the code I realized it would take some work doing it the way they did it so I decided to just at a regular expression at right point.
Thing is, regular expressions are great but when they finally result in something like this, I have to wonder "WTF am I doing???":
(\s*)(?:([^=\s]*)(?:(?:(\s*?=\s*?)([^\s"]+))|(?:(\s*?=\s*?)(".*?")))?)
<input type= checkbox name = "checkme" selected>
- " "
- "type"
- "= "
- "checkbox"
- " "
- "name"
- " = "
- "\"checkme\""
- " "
- "selected"
Java GPL
Original post date: Mon Nov 13 12:00:00 2006
Wow, for me this definitely is an historic day, Sun will release the entire Java platform as open source! And they're not just using any license, they are actually releasing it under the GPL!
But even more incredible in my opinion is Jonathan Schwartz, director of Sun Microsystems, admitting that the final push for selecting the GPL was the Microsoft-Novell anouncement last week about protecting eachother's customers from patent violations:
Of course, Richard Stallman will have to revise his infamous essay "Free But Shackled - The Java Trap", but he doesn't seem tomind much, in fact he seems pretty pleased, commending Sun for taking a leadership role and saying that this makes Sun the world's biggest single contributor of open source software.
Personally I would like to see how the Linux distros will pick this up. RedHat for example has always been a big supporter of Java, spending a lot of time and effort to make sure that projects like GNU Classpath and GCJ work perfectly on their systems.
How will it all work out? Is there any use for the Classpath people to continue now that their goal of having a free implementation of the Java class libraries has been attained in one fell swoop?
And how will GCJ be integrated into all of this (because that's one project that is not going away for sure because native code compilation will always be more interesting to some people than relying on JIT compilation and the Hotspot optimizer)?
This is all so exciting! I can't wait for the future to arrive!
Wow, for me this definitely is an historic day, Sun will release the entire Java platform as open source! And they're not just using any license, they are actually releasing it under the GPL!
But even more incredible in my opinion is Jonathan Schwartz, director of Sun Microsystems, admitting that the final push for selecting the GPL was the Microsoft-Novell anouncement last week about protecting eachother's customers from patent violations:
By admitting that one of the strongest motivations to select the GPL was the announcement made last week by Novell and Microsoft, suggesting that free and open source software wasn't safe unless a royalty was being paid. As an executive from one of those companies said, "free has to have a price."That's nonsense.
Personally I would like to see how the Linux distros will pick this up. RedHat for example has always been a big supporter of Java, spending a lot of time and effort to make sure that projects like GNU Classpath and GCJ work perfectly on their systems.
How will it all work out? Is there any use for the Classpath people to continue now that their goal of having a free implementation of the Java class libraries has been attained in one fell swoop?
And how will GCJ be integrated into all of this (because that's one project that is not going away for sure because native code compilation will always be more interesting to some people than relying on JIT compilation and the Hotspot optimizer)?
This is all so exciting! I can't wait for the future to arrive!
Subscribe to:
Posts (Atom)

