Home > Domino Tips > Developer > Brian Mahoney on Java vs. LotusScript
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

LOTUSSCRIPT

Brian Mahoney on Java vs. LotusScript


Brian Mahoney
03.29.2004
Rating: -3.83- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


View member feedback to this tip.

Brian Mahoney
SearchDomino.com member Teck Lung recently posted this question in our developer discussion forum: What are the advantages and disadvantages of writing a Java agent over a LotusScript agent? We asked some of our resident experts to give their thoughts about LotusScript vs. JavaScript. SearchDomino.com's application development expert, Brian Mahoney, offers his advice in the first installment of our developer tip series on Java vs. LotusScript.

To Java or not to Java?

That is the question. We often get questions about when to use Java rather than LotusScript. Back when LotusScript was first introduced, the question was when to use LotusScript over the formula language. Now it seems almost second nature and usually self-evident to use LotusScript, so the question rarely comes up. (Although I do remember having a conversation last year with a longtime Notes developer who was still using formula when LotusScript may have been much more appropriate.)

Sometimes it's just a matter of preference when it comes to determining which language to use. If that's what it comes down to for you, and you can use Java, then I would go with Java. In the long term, I think it would be better use of your skills and help increase your proficiency with Java, something that is more likely to be marketable in the future. But if you are the only person in your shop familiar with Java, then there is always the issue of just who is going to maintain the code if you're unavailable.

Sometimes you just can't Java

Sometimes the tasks you are trying to perform just don't lend themselves to Java development. If you need access to the Notes front-end (UI) classes, then Java is not an option. If you plan on using COM classes to access other applications like spreadsheet or word processing applications, again, Java won't fit your needs.

Sometimes it's better to Java

When you have a certain task to perform, Java is the more logical choice. If you need to integrate your code with Websphere or other J2EE applications, use Java. If your code will be parsing data and/or reading Web pages, go with Java. Its string class provides a wide variety of methods for parsing data. Extensive and ever expanding, libraries provide methods for networking, handling graphics and much more. You can import a library into your project and the methods are available to you.

And, of course, Java is designed to run on many different operating systems. The choice of which language to use still comes down to your personal choice, but considering the differences, you can make a better, informed decision.

If you do Java be aware

There are a few things that you should be aware of if you haven't coded in Java before. Java is case sensitive, so referring to the variable myDatabase is not the same as my Database. In Java, a string never changes. You need to use a StringBuffer to concatenate and work with strings.

In Java, the console is your debugger. You don't have extensive debugging capabilities and will rely on the Java equivalent of print: System.out.println("Your debugging message").

But the biggest "Gotcha!" for beginning Domino Java developers is the need to recycle. When Java accesses Domino, it is doing so using the C API. Unlike LotusScript, which does extensive cleanup and garbage collection for you, you need to indicate what is garbage. To do this, use the recycle method once you are finished with a Domino object. For example: view.recycle(). This is very important to prevent memory leaks, which lead to exploding applications.

Where to start

This is a really high-level look at some of the things you need to consider. If you're an experienced Domino programmer, the basic syntax in Java is the same as the syntax in LotusScript. The Domino Object model is the same, although classes don't usually start with Notes. So what you want is a jump-start course and reference. A good place to start is Team-TSG.

Team-TSG (Two Short Guys) is the pairing of the Domino and Java expertise of Joe Litton and Tom Duff. The TSG site has links to their Lotusphere 2004 presentation, Java For The Domino Developer. In addition, each of their sites have some great tips and experience with Domino and Java (among other things). They recently wrote articles in Lotus Advisor Magazine on getting started in Java for Domino Developers (December 2003 and February 2004).

Other resources/references

Books

Web Sites
Brian Mahoney is a developer for a financial-services firm in the Philadelphia area. In addition, he consults on technical and Web-related issues for a number of small and medium businesses. He has more than 10 years of Notes/Domino development and administration experience. He is a CLP application developer and administrator and a SearchDomino.com expert.

MEMBER FEEDBACK TO THIS TIP

I think that Mahoney has taken a very simplistic view of this issue. Generally we take the following approach for the following reasons:

  1. When programming exclusively in the Lotus Notes Client, use LotusScript due to the access to the front-end UI classes.

  2. When programming exclusively for the Web use Java, both in query open and close agents, although I like to stay away from these if possible and use a Java Applet and Servlet for all retrieval of data such as lookup lists.

    The use of a DBLookup and DBColumn applet and servlet enables the developer to avoid page refreshes with cascading selection lists, thereby removing a significant performance hit from straight Domino @function-driven Web applications.

  3. Where there is the need to migrate a Web application to a J2EE platform at a later stage, we use HTML and JavaScript coupled with an n-tiered Java framework that is activated from a Domino agent to build high functionality applications. The only Domino design elements used are views and one agent. This provides a future growth path at minimal cost and gives a significant improvement in performance as Domino is only being used as the data storage mechanism.
-- John P.

***********************************************

Thanks for this article. I was stressing out about having to learn Java, but as I'm mainly developing in-house databases, it looks like I can probably put off learning Java for a while and concentrate upgrading my skills/qualifications to R6.

-- Walter P.

Do you have comments of your own? Let us know.


Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Java
Java code inserts data from Notes documents into a SQL table
Java code shortens strings in a SQL table
How to execute a stored procedure in Lotus Notes Domino using Java
How to return an HTML representation of a Lotus Notes rich-text field
Shrink Lotus Notes databases with many attachments
Converting Lotus Notes Domino Web pages to PDF files with a Java agent
A bevy of Notes/Domino development tips
Converting Web pages to images using Java
Creating Microsoft Word documents from Lotus Notes
FAQ: Java for Lotus Notes and Domino

LotusScript
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management
LotusScript agent automates selective mail file replication
LotusScript filters and attaches files to a Notes form

Java for Lotus Notes Domino
Top 10 Lotus Notes/Domino coding and development tips of 2008
Java code inserts data from Notes documents into a SQL table
Java code shortens strings in a SQL table
How to execute a stored procedure in Lotus Notes Domino using Java
Top 10 Lotus Notes Domino programming and development tips of 2007
How to return an HTML representation of a Lotus Notes rich-text field
Shrink Lotus Notes databases with many attachments
Converting Lotus Notes Domino Web pages to PDF files with a Java agent
Developing Eclipse plug-ins for Lotus Notes and Domino -- 7 tips in 7 minutes
A bevy of Notes/Domino development tips

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts