Wednesday, May 7, 2008

JavaOne 2008 - May 6th Technical Sessions

With a lot of excitement I went to the first session of my JavaOne 2008 - TS-4992 (Funambol Java Platform, Java ME technology based open-source Messaging Client). What I was looking for from the session was to see how Java ME and messaging work. To learn about its application much more than SMS purposes. Unfortunately, the session turned out to be less about it and more about the product and information that I was really un-interesting to me. In between I walked out expectin to jump into TS-5771 (PHP meets Java - the best of both worlds), but I was not allowed since it was full. Disappointed, I decided to check my mails and do some work.

I hopped into my next session TS-6623 (More "Effective Java") which was totally packed. By the time I got in (given that I am a Sun employee and get the last opportunity to attend a session), the session had already started and Joshua was at the end of his Generics - the wildcard usage and largely concentrated on Enum this year. His session is always thought provoking and to me most of it I get better only after stepping out and reviewing his presentation. My notes for the session are at the bottom.

Had a quick lunch and got back to the Pavilion. Visited couple of booths of which noteworthy was Spring Source where I could not get all the information I needed in what Spring Source is about and will have to revisit.

Took off for a TS-5870 session (JBI and SCA best of both worlds). Again by the time I got in the session was already on and based on the content my understanding was the presenters were from Apache Tuscany and ServiceMix contributors. It was good to see some one putting together the complimentarty technologies which are largely misunderstood to be competitive specs. The presentations was more XML based and I happen to capture some notes below under corresponding TS number section.

My next stop was at TS-5921 (Glassfish v3 - an extensible modular platform). The session was very interesting to know the directions the GF is headed towards and how OSGi is reshaping the technology world. GF v3 is being built upon OSGi while also keeping its HK2 modular framework which was pre-built and going forward would sit on OSGi. Other highlights included the 2MB footprint and lazy initialization of containers eg: web containers are used only when needed. The interesting gap here in was the management of all these modular components. Some notes at available under corresponding TS number section.

The next session was TS-5711(jMonkeyEngine and gaming in Java) which was more out of curiosity. Some notes are available under corresponding TS number section.

After which I got into BOF-5150 (Event Driven SOA in Java using OSGi and Spring). I personally did not find it very interesting since the perspective with which I went for the session was to learn about ED using OSGi and Spring. It so happened the content was more on BEA products. At the point they started talking of JRockit I decided to quit since the subject was very diferent from the presentation. I hopped into BOF-5552 (Java Platform Observability by ByteCode instrumentation). This happened to be very interesting in how you could use bTrace utils annotations to debug code at byte level. Some notes are available under corresponding TS number section.


---TS - 4992 Funambol: JavaME & open src messaging client -----------------------
Funambol SDK - Java ME

NOT WORTH

JSR 75:

toSerialFormat - to set VCard info
fromSerialFormat - to read contact info

SyncML

Push EMail:
SMS and TCP based
ME platform
email on mass market handsets including black berry
Impl:
- Using SMS - app registers with PushTRegistry for incoming SMS
- Using Socket -
- CTP: app manages socket open to CTP server that uses it for sending notifications
- STP: app starts server socket and waits for server notifications
IP natting, proxies
- Socket * STP

------------------------------------------------------------------------------

---- TS - 6623 More Effective Java -----------------------------------------------
Wildcard usage, follow the rule:
PECS: Producer extends, Consumer Super

Dont use wildcard types as return types

1) void pushAll(Collection rc);
void popAll(Collection dst);

void pushAll (Collection src);
src is an E producer
void popAll(Collection dst);

user canpush ALl from a Collection or a Collection onto s Stack
user can popAll into a Collecton or a Coll from a Stack

2)
public statc set union(Set s1, Set s2) -
Both s1 and s2 are E producers
No wildcard tpe for return value
wouldnt make API any more flexible
would force user to deal with wildcard types explicitly
user shold not have to think abt wildcards to use your API

Enum types:
How to implement no of musiciansl

public enum Ensemble {
FIRST SEC THIRD FOURTH FIFTH SEXTH SEPT OCT NOV DEC
public int numberOfMusicians() {
return ordinal + 1;
}

}

Wrong
- maintenance nightmare - somene reorders constants, prg brekas silently
- Cant add multiple constants wih


public enum Ensemble {
SOLO(1) DUET(2) TRIO(3) FOURTH FIFTH SEXTH SEPT OCT NOV DEC

priv final int nofOfmusician

Ensemble(int size) {
return ordinal = size;
}


public int numberOfMusicians() {
return ordinal;
}
}


One way to represent set is Bit Fields
Eg:
public static int ITALIC = 1;
public static int BOLD = 2;


Bit Fields are obsolete

Why not use Bit Fields: (All problems of int constnts and more)
- Not type sfe
- No namespace
- Brittle - constants compled into client
- Printed values are cryptic
- No easy way to iterate elements represented by bt field
- Not scalable: no of constants grows beyond 32, you are toast. Beyong 64 your burnt.

Use EnumSet

public class Text {
public enm Stype {
BOLD, ITALIC, UNDERLINE, STRIKETHROUGH
}
//
public void applyStyles (Set

No comments: