Posts Tagged ‘Java’

Microsoft PDC09 Connected Show Podcast #21

December 31, 2009

Wanted to thank Peter Laudati and Dmitry Lyalin for having me on Connected Show Podcast #21 with Sara Chipps recently.

We covered a lot of ground during the podcast and Peter posted all of the relevant links.

There was a lot of great news at PDC09 but I was most fascinated by Microsoft’s support for building Java Apps with Windows Azure.

For the Java Developers out there, here’s the “Building Java Apps with Windows Azure” session.


Technorati Tags: ,,,,

Will Java 7 Erase Erasure?

April 30, 2007

I just got back from a great NYC Java SIG event.

The esteemed adjunct professor of computer science at Polytechnic University in Brooklyn and author, Elliotte Rusty Harold, gave an interesting presentation on Java 7 and Beyond.

The slide deck will be posted on his web site soon.

Some of the new Language and JVM features being discussed for Java 7 are:

  • Superpackages
  • Language level XML support
  • JavaBean property support
  • BigDecimal operator support
  • Strings in switch statements
  • Comparisons for Enums
  • Short instance creation
  • Closures
  • Type Literals
  • Reified Generics
  • Java Kernel
  • invokedynamic
  • More script engines
  • Tiered compilation
  • Miscellaneous ideas

You can read more about it here.

The one feature that surprises me most is Reified Generics. The Erasure versus Reification issue has been a hot topic in the industry.

Java implemented Generics using Erasure which means that the generic type info is not available at runtime. Reified generics is the alternate approach where the generic type info is available at runtime.

It’s interesting because reification is the long standing Microsoft .Net approach. Whereas erasure is the Sun Java approach.

Neal Gafter writes about it here. Bruce Eckels has a 4 part article on the topic here.

The big complaint with Java Generics is that it’s too complex.
This Java Generics FAQ is 425 pages!

Java 7 is still evolving but it’ll be interesting to see if it eventually adopts the Microsoft way and erase erasure.

Java 5 Concurrency in Practice – Brian Goetz

September 28, 2006

I attended a Java SIG Meeting that was held at Google’s NYC office recently.

BTW, all Java SIG presentation slide decks are archived here.

The meeting was a presentation on Java 5 Concurrency given by Brian Goetz. (See photos)

As you may know, multi-core CPUs have escalated the need to develop multi-threaded apps.

Brian introduced some refreshingly new concepts such as CountDownLatch, Exchanger, Executors and Future Interface. I’ll have to blog more about it later.

In any case, both Java and Microsoft have interesting concurrency framework stories to tell.

Microsoft and Sun are developing Concurrency Libraries that will ultimately minimize the complexity of multithreaded programming.

Microsoft’s library is called Joins and it will eventually get baked into .Net. More info here.

The Java Concurrency Library is the JUC package (java.util.concurrent). More info here.

IMO, in depth knowledge of the new concurrency libraries will be required by most software professionals over the next few years.

An embarrassing concurrency bug reared its head during a Microsoft Demo recently. You can read all about it here.


Brian Goetz 1 

Brian Goetz 2 

Brian Goetz 3

Best of Java Puzzlers – Josh Bloch

April 19, 2006

I just got back from a "Best of Java Puzzlers" presentation that was held at Google’s NYC office.

The Google NYC Office is currently located in Times Square (1440 Broadway) but they will be moving downtown in July 2006.

The Java Puzzler presentation was given by world renowned Java Expert Josh Bloch.
Josh is an entertaining speaker.

He quickly walked through 8 trick Java questions.
It’s interesting stuff for Java developers especially Java Certification folks.

You can download all of the puzzlers here:

This is one of them.

public class Elementary {
  public static void main(String[] args) {
      System.out.println(12345 + 5432l);

The casual observer would say that the answer is: 66666
Surprisingly, the answer is: 17777

The trick is the first digit of 12345 and last digit in 5432l. The last digit is really a lower case L.
So the compiler interprets 5432l to be a Long data type containing 5432.

  12,345 + 5,432 = 17,777

This is another one:

public class LongDivision {
    public static void main(String[] args) {
        final long MICROS_PER_DAY = 24 * 60 * 60 * 1000 * 1000;
        final long MILLIS_PER_DAY = 24 * 60 * 60 * 1000;

        System.out.println(MICROS_PER_DAY / MILLIS_PER_DAY);

Once again, the casual observer answer should be 1000.
However, due to a data type overflow, the real answer is 5.

The problem is the MICROS_PER_DAY calculation (24 * 60 * 60 * 1000 * 1000).
Internally it uses a regular int data type which causes an overflow.

To fix, just need to append ‘L’ to any one of the number literals:
  final long MICROS_PER_DAY = 24L * 60 * 60 * 1000 * 1000;

Afterwards, I asked Josh if he agreed with Bruce Eckels comments that the Erasure approach to generics was a mistake.

He quickly stated that he completely disagrees with Bruce Eckels.

Josh believes that Erasure is a great solution.
It’s the best way to solve the "upward compatibility with existing code" problem.

I’ll dig a little deeper into Erasure versus Reification (Microsoft’s approach) in another blog entry.

In the mean time, Josh pointed me to Neal Gafter’s great blog entry about it here.