Advantages of Java
In my opinion, the primary advantage that Java has over LotusScript is its support for network-enabling your agent. Your agent can get a resource on the Internet and do things based on what it finds.
Here's an example: I have a customer that wanted to display stock information in its Lotus Notes client-based portal. They wanted to display on the company Web site what the current bid/ask price was and if the price was going up or down. They already had a subscription with a stock information broker that delivered this kind of information as an XML file available on the Internet using a special URL. For the portal, we created a Java agent that connected to the XML resource every five minutes and dumped the contents into a Lotus Notes document. The rest was @DbLookups from a Page in Lotus Notes.
If I were to create the same functionality in LotusScript, I would have had to do Windows API calls on the server. Had my customer been running Unix on the server, I would have been unable to do it using LotusScript at all.
Also consider the Java language itself. The language has a lot more classes, functions etc. available than does LotusScript. And if you can't find a class that does what you need, you will probably be able to find it available for free on the Internet. The Java community is bigger than the LotusScript community.
Advantages of Java that aren't really convincing
Then there is the standard advantage that you often hear about: Everyone is moving towards Java and eventually LotusScript will disappear. Well I really don't buy that argument. IBM and Lotus have a tradition of taking care of backwards compatibility. If your application was originally created in Notes 3, it's actually quite a safe bet that it will also run on R7.
Disadvantages of Java
The greatest disadvantage that Java has (in the Notes and Domino context) is the lack of a proper development environment. Debugging is a pain. If your agent is to live in a Notes database, the obvious place to code it is in the Notes database. But then you are left with debugging in the way that you do it when coding with @Formulas, printing to the Java console. You can't step through the code as it executes and examine objects and variables as you like.
One of my colleagues, who codes a lot more Java than I do, says that this is not really a disadvantage. You just do your Java coding in an external development environment (Eclipse is recommended) and then move the code in to the Notes database when you have finished coding. When developing in an IDE like Eclipse, you will still be able to access the Lotus Notes objects such as the database, view and documents. When debugging, you are able to examine your objects and variables.
Depending on what you want to do with your agents, a disadvantage is that Java agents are restricted to the Domino back-end classes. No NotesJavaUIWorkspace is available.
How to decide
To me it's not a matter of choosing either Java or LotusScript for all my agent coding. I like to make my choice of language depending on what each agent is to do. Some agents are written in Java, and some are written in LotusScript.
Of course, other issues can have an impact on how you decide. If the organization wants to strengthen the Java skills of its technical staff, you might want to decide that most of your agents should be coded using Java.
Jens Bruntt has been a developer and infrastructure advisor for Notes and Domino projects since 1994 and is an R6 Principal Developer working as project manager or consultant depending on the project's size and requirements. Jens is working at Danish Convergens as a senior consultant, primarily architecting Domino browser-based Internet, intranet and extranet sites.
What about the speed of Java execution vs. LotusScript? Which is faster? The biggest disadvantage of Java in general has been the lower execution speed. (Load any Java app on your PC and you can usually see the difference.) Perhaps LotusScript's overhead might make up the difference?
-- Joel B.
Do you have comments of your own? Let us know.
This was first published in April 2004