Q

  • "There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies." - C.A.R. Hoare

July 09, 2009

Javascript: SS and otherwise.

Javascript was standardized as Ecmascript but retains it's own identity as the implementation in Firefox. Javascript is Ecmascript compliant but has extensions that may or may not be standardized in future Ecmascript versions. Firefox currently implements Javascript 1.8.1 which is compliant with Ecmascript 3 and E4X. Ecmascript For XML (E4X) implements XML as a built-in datatype making it easy to manipulate XML without using DOM, SAX, XPATH or other XML APIs.

Javascript is an embedded language. Unlike general purpose languages such as C++, Java, and Python, Javascript does not have libraries for common computing resources like file system, network or database access. It relies on the host environment to provide whatever is needed. Javascript does specify how an implementer can include built-in objects that are available at run time and host-provided objects that are unique to each embedding context.

In the browser, host objects include Window and DOM objects. Firefox, much of itself being written in Javascript, provides access to most of the Mozilla platform objects and general purpose objects for local (non-web) applications. These objects included file IO, network IO, password encryption, Sqlite and XUL UI elements. Firefox extensions have access to these objects. Java libraries are also available to Javascript in the browser via LiveConnect. The javascript implementation in Firefox is called Spidermonkey. There are several projects that use Spidermonkey on the server. One example is CouchDB.

In the late '90s, Netscape decided to rewrite the their browser, Navigator, in Java (Javagator). The only piece that was completed and remains today is the Rhino Javascript implementation. Rhino is an actively maintained open source project. Rhino is written in Java and interpreted or compiled to JVM Bytecode. Rhino has both an interpreter and a compiler. The host objects in Rhino include all available Java libraries. Rhino is currently Javascript 1.6 compliant. There are several projects that use Rhino on the server, including a Rails clone.

Javascript on a vritual machine is the same language but with access to all computing resources of the VM rather than the limited, though very useful for web browsing, resources of a security-sandboxed application like a browser.

The Javascript implementation in XPages, like Rhino, is written in Java and executes on the JVM. Host objects provided by XPages include the Notes Java API, and the JSF APIs. Expeditor supports the JEE stack up through JSF so XPJS running on the client would have access to the same libraries.

XPJS is Ecmascript 3 compliant with two exceptions that I know of: @Functions and optional type declarations.

@Functions in XPJS are built-in objects provided by the language implementation. Many of these functions are dependent on the Notes and Java host objects. In order to allow these function names to start with "@", the XPJS language definition was "altered" (hacked!) to allow any identifier to begin with the "@" character. You can write your own function names starting with "@". Please don't. Actually, you can start any identifier with "@" ( var @x = 1; ), but, again, use a namespace object or some other standard convention to keep your functions out of the global namespace.

The other language addition is optional type annotations. This was proposed by Mozilla for Ecmascript 4, so it makes sense that Lotus adopted it in the Workplace timeframe. Since then, events have significantly changed the Ecmascript roadmap and put many of the proposed Ecmascript 4 features, including optional type annotations, in flux. What does the optional type declaration do? It provides the developer with a visual indication of type and the interpreter/compiler can warn of certain type errors. What it doesn't do is include that type information in the generated bytecode. There is no run-time benefit as with statically typed languages. This is consistent with Javascript being a dynamically typed language; all types are resolved at run-time. I confirmed this with the XPages team at Lotusphere.

For several years, there had been two camps battling over the Ecmascript roadmap. One camp, led by Mozilla CTO, Brendan Eich who created Javascript, proposed  a  somewhat radical roadmap that would have added classes, packages, optional type declarations and many other features available in popular general purpose  languages. This roadmap was known as Ecmascript 4. The other camp, led by Microsoft and Yahoo, proposed a much less aggressive incremental roadmap that didn't expand the scope of Javascript beyond the web. This roadmap was known as Javascipt 3.1.

Last year, a compromise called Ecmascript Harmony (Ecmascript ~6) was reached. The Ecmascript 4 camp had to concede some of the more radical changes to reach an agreement and get everyone moving forward. Packages are out. Classes will be implemented as syntax sugar for closures rather than a new construct. Optional type annotations may happen. What about Ecmascript 5? The 3.1 proposal became Ecmascript 5, which is the current draft proposal.

I hope that XPJS will maintain Ecmascript compatibility and perhaps even implement E4X. I know that they would like to do it, but other priorities, including performance, may delay things. I'd hate to see XPages developers using an outdated, non-standard scripting language a few years down the road. Please don't Lotusscript the Javascript. Speaking of performance, InvokeDynamic, the first new bytecode added to the JVM in 14 years is now in early draft review. Dynamic method invocation is about to get a whole lot easier and faster.

So was this just a transparent attempt to express my dislike of "SSJS" to describe XPages Javascript? Yes, it was. I may be too late ;-)

Update @headius I just heard there's a good chance invokedynamic will get into a Sun Java 6 update, via a flag and separate rt.jar add-on. [@headius is Charles Nutter, JRuby implementor and Sun/Oracle employee]

June 15, 2009

Google Wave Protocol coming to the Eclipse Comunication Framework

This will make it easy for Eclipse and/or any Equinox, RCP, or RAP-based application to interoperate with other Google Wave applications.

 Google Wave and ECF

May 28, 2009

Google Wave - a personal communication and collaboration application and platform

Google announced a personal communication and collaboration application today called Wave. It is also a platform for collaborative applications. Here's some links:

O'Reilly's post

Live Notes from the announcement

Screenshot

Update:

Google Wave Protocol

Google Wave Federation Architecture

May 08, 2009

Innovation killers

I recently read an article that resonated with me titled "Killing Innovation with Corner Cases and Consensus". Key point:

A corner case is an objection that may be:

  1. technically reasonable
  2. may have a probability of occurring
  3. its probability of occurring is lower than your probability of running out of money

Read the whole thing.

James Governor read it and posted "Corner Cases Can Kill Innovation 2: The Big Dogs Are Too Big" which makes an entirely different point:

...the needs of a tiny minority of customers dictate overall product generation, skewing the overall direction of innovation.

The Innovator's Dilemma comes to mind.

May 01, 2009

Miss Lotusphere? Try Impact 09.

This is too funny (Lotusphere, South Park):

Come to IBM Impact 2009 in Beautiful Las Vegas, May 3 - 8

March 11, 2009

Mind blowing browser based UI/App builder

Check out Atlas from 280 North. Watch the video. Then have a look at 280 Slides, a Keynote clone built on the underlying Cappuccino platform. Awesome. Just awesome.

February 22, 2009

On the future of Lotusscript

There's a lot of noise flying around about the future of Lotusscript (again). Here's my take.

Lotusscript the language as implemented by the Lotusscript compiler has been near-dead for years. NOT dead in the sense that it will be removed from the product but in the sense that there have been so few significant enhancements since R4. There have been some library additions but the language itself has changed less than any other langauge that I use.

What does this mean for the Eclipse Lotusscript editor? Not much. The editor still sends the code as text through JNI to the same old compiler. Don't expect language enhancements just because there are newer and better tools. While I welcome the new tools, I would rather have a better language. Unfortunately, that ship has sailed for Lotusscript.

What I'd like to see but was convinced in Orlando will not happen: Use one or more of existing langauge implementations for the JVM. I'd like to see IBM work through the Not Invented Here and intellectual property issues. IBM uses Jython as a scripting language for Websphere. Groovy is one of the two languages used to build applications with Websphere SMash. The other is IBMs own implementation of PHP for the JVM.

Speaking of IBMs own implementations of languages for the JVM, we have XPages javascript, which is a good example of why I would like to see IBM use existing implementations and STOP building everything in house. XPages javascript is years behind the Javascript in your browser, especially if you use Firefox. (see javascript 1.6/E4X, 1.7, 1.8)

These languages allow you to leverage Java to any extent needed such as domain objects, performance, APIs for third parties, etc. What about "just learn Java"? Yes, by all means..I did, but just as with XPages, a JVM hosted scripting language is often the right tool. (see Ola Bini on Fractal Programming).

Having a powerful, class-based OO scripting language would also reduce the class->prototype->class impedance mismatch that developers moving to Java from Lotusscript have to deal with when using Javascript. I'm not arguing against Javascript, I love the language, but it would be nice to have a class-based OO option (OOption :-?).

The APIs to integrate these language implementations with Java are in Java 6. A tutorial on  how to use the Dynamic Language Toolkit Framework to build Eclipse tooling for them was recently published on developerWorks.

XPages for the client may surprise me. I hope so. And for web apps, the browsers are moving toward other language implementations. Imagine the Run On Server/Client option for Ruby or Python.

This really wan't much about Lotusscript. That's because there's not much to say except "Thanks for the Eclipse tools, they're sorely needed and appear to be very well done".

February 14, 2009

Eclipse E4 Milestone 1


For a glimpse of the future, have a look at the first milestone of the Eclipse E4 project. Two goals of the project are:

  • Simplify the Eclipse programming model
  • Enable the platform for use on emerging web-based runtime technologies

Would you like to use CSS to style SWT? What if you could cross-compile SWT to Flex or Dojo?

For working examples of these and more see Eclipse E4 M1 New and Noteworthy.

E4 is an incubator project. The features developed in E4 are not targeted for any specific Eclipse release.


November 14, 2008

Double Black Diamond Sessions...

EclipseCon is using the ski run difficulty standard for session submissions. Something to consider for Lotusphere 2010 technical sessions. Techincal depth is not the problem it was in the (distant) past. I didn't attend between 1997 and 2006 so I don't know how things were then but a rating system of some sort might help.

Via More Difficult = More Attractive

October 07, 2008

50 States

50states_3