Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Thursday, May 1, 2008

About roaches & Java: Climbing with grace (with Scala!)

There is some tension around about Java: what is the Next Big Thing(tm)?, is Java mature?  Is Java dead? .... The fact is, as has been said elsewhere, that Java has reached cockroach status: meaning there is no way back. So Java is now on par with Cobol, Fortran and C: code (and work) is not going away! Also Java has set the bar higher than any other roach before it: 
- Cobol: legibility, closeness to user model
- Fortran: numerical and algorithmic expressiveness
- C: portability, simplicity, closeness to underlying  model, speed
- Java: garbage collection, objects, dynamic loading, virtual machine, language interoperability, APIs, IDE ...
For a future aspiring roach it has to at least be able to have the characteristics of all previous roaches. (When I say Java of course you can put .Net if you are living in that closed world).
It seems the dev world is, at last, ready for FP (wether newcomers are ready for it is another question. But newcomers are forced to do what they have to do). And of all the proposed New Things it seems Scala is the thing that retains most good Java things and adds most good "new" things.
What Scala has got now:
1. Exceptional Java interoperability
2. Great (for a non pure FP) functional constructs
3. Better OO than Java (traits, companion objects)
4. Nice core community (and I mean nice, being nice to newcomers and to other players is a must some Gollums have learned the hard way ...)
5. Academic soundness 

What Scala is missing right now (to be on a par with what Java has got):
1. Good tutorial: there is a book in the works that may be of the right level for Java developers. There are a bunch of scattered blog entries around. Missing: use cases and idioms, more Java frameworks-Scala samples
2. API stability and development: more Java helpers-wrappers, better documentation.
3. Killer applications?: Java, and the JVM, is the "killer application" of Scala.  
4. Patronage: Academia is behind Scala but some further industry support is needed. Plugins for main IDEs are on the way, but Scala is a more complex language to support that others.
5. Clearer roadmaps: Although stability is settling up lately, the only way to know where we are heading in the next moths is to check the bug
6. Better visibility: There is a need for more "in the wild" tools, programs, frameworks, applications, API. And this is where most of us should be working on. Start using Scala for some small projects now !

Tuesday, February 12, 2008

Using LDAP SDK on OS X with NetBeans

As an example of integrating an external jar for use with NB in java projects ... Probably it is better to stick with what is provided by JNDI, it is much better now, but if you have a project that uses ldapsdk.jar: 

  • Download  ldapsdk_java_20020819.zip from http://www.mozilla.org/directory/javasdk.html
  • Unzip it, there is a buildjsdk.txt that hints about the next steps
  • cd to mozilla/directory/java-sdk
  • execute make -f ldap.mk JAVA_VERSION=1.4 to get .class files (optional)
  • execute make -f ldap.mk basepackage to make the ldapsdk.jar (optional, previous command required: 301968 vs 301913 bytes in the jar I "inherited")
  • execute make -f ldap.mk doc JAVA_VERSION=1.4 (to generate javadoc)
To successfully execute the previous commands you may need to:
edit ldap.mk : add -source 1.4 -target 1.4 to each JAVAC variable definition like:
JAVAC=$(JDKBIN)javac -g -classpath "$(JAVACLASSPATH)" -source 1.4 -target 1.4
---
JAVAC=$(JDKBIN)javac -g -classpath "$(JAVACLASSPATH)"

create some environment vars: export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home
All this mess  is needed because the sdk uses enum as an identifier, and Java 5 uses enum for the typesafe enumeration pattern, as a reserved word. You need to either change the source code or compile for Java 1.4 ... So much for Java's backward compatibility. Still, you may get some deprecation warnings ...
  • Open NB (5.5.1): Tools -> Library Manager
  • Create a new library
  • add ldapjdk.jar to Classpath
  • add ./mozilla/directory/java-sdk to Sources
  • add ./doc to Javadoc
Add to your project the library you just created (and maybe remove the previous jar). You may need to restart Netbeans (to reload the classpath).
Test: 
  • Try MR-> Go to Source
  • Put breakpoints 
  • Use the "." for contextual javadoc, code completion ...


I hope my next NB entry will be about a detailed installation of Scala support in NetBeans (see Caoyuan's fine work)