I have been writing object oriented Lotusscript for a little over a year now. When I started, I probably did a lot of mistakes, and I did not fully understand everything about object oriented development. I can’t say I am an expert yet, but I wanted to share some information that hopefully will help anyone else looking into switching to object oriented Lotusscript (OOLS).
WhyOOLS?
I see several benefits, at least to me. The code is usually shorter and I get a better overview. It is modular and can easily be moved to other applications. It is easy to maintain and add functionality. And the calling code can be very compact and easy to understand as well.
Is OOLS hard?
Not really. You have to grok it, but as soon as you do that, it all falls into place. My background was in pure procedural programming, and it did not take me very long to get the concept.
How do I write OOLS?
You write class definitions and code in the Declarations section of your code. I usually put the code in script libraries,usually several related classes in one script library. I name thescript library after the main class, so in my claim system I havescript library called Class.ClaimData, Class.FinancialTransactions and Class.ClaimLink.
The code is just regular Lotusscript. You define a class, with one or more functions/subs. You can also define variables in the class to store data. Functions, subs and variables can beprivate (only accessable inside the class) or public (accessable from the calling code). You should always have a Public Sub New() defined in the class.
Can I seesome example of a class?
Sure. I have posted a couple of classes in the past, both here on my blog and on OpenNTF.org.
In part 2 I will explain a simple class and how it can be used.