To make it clear right from the beginning object-oriented programming is not the cure for all your problems. It is absolute possible to write custom classes in a foolish and unstructured way. On the opposite you can write a really good Notes application only with formula language. At the end of the day there is only one thing that matters. The user must be able to accomplish his task in an easy and efficient way.
But from my point of view there are a lot of good reasons for object-oriented programming (OOP) in LotusScript.
Develop on a higher abstraction level
The most important reason for me is to focus on the essential. Through a wisely build class hierarchy you can develop on a higher abstraction level. Regardless what kind of publication about software development you read there is one point on which they all agree. The developer has to understand the domain model and map it into code. With object-oriented programming the elements from the domain model become objects with properties and methods. Instead of think about whether to use a view or a folder the focus is on dealing with the elements from the users world and this is the essential.
Cope with complexity - divide and conquer problems
The world in which we live is complex. Object-oriented programming is one way to cope with this complexity. The basic concept is to devide the problem in such a way that it becomes manageable. (divide et impera / divide and conquer)
I will try to clarify this with an example. In an application for managing business trips a journey has to be submitted for proposal. The method journey.requestProposal has to check for all necessary data, the manager has to be informed, the journey has to be added to the calendar, the status has to be changed and the document history has to be written. Instead of writing a monolithic block of code the methods calls others methods from this class: journey.isValid, journey.informManager, journey.addToCalendar, journey.setStatus and journey,writeDocumentHistory.
Enhance your codes’ readability and maintainability
By splitting into different methods the readability of the code is enhanced. You no longer has to scroll through several pages of code on the screen just to understand what is going on. Shorter blocks are much easier to read and understand. Which comes quit handy if the code has to be maintained. Remember the next poor soul how has to fix your code, could be you.
Improve the reusability of your code
The functionality to generate an email and to create a calendar entry will not only be useful in just our sample application. Which leads use to the next advantages of object-oriented programming: reuse of code. Something like the Holy Grail of programming.
Sure it is easy just to write a generic function to generate emails and but in into some shared script library. But a function is not as flexible as a custom class could be. It is much simpler to control certain properties of this email like the priority or the request for a return receipt via the properties of an email object. The only chance to do such things with a function is to provide a lot of parameters for all kind of purposes. If the number of parameters rise to a certain level the chance for an error also rises. Sometimes it could really be hard to remember whether the fifth "true" was for requesting a return receipt or for enabling encryption.
Increase flexibility and extensibility of your solutions
Stressing advantages of object-oriented versus procedural programming, here is another one: increased flexibility and extensibility. If a new parameter for a function is added every line of code which uses this function has to be edit. If you add a new property or method to a custom class all existing code using this class can remain unchanged. (Alright, it is a good idea to run "Recompile All LotusScript".)
Specially with the use of inheritance it is quite easy to start with a generic approach and build a basic custom class. If there is the need for a more special implementation the already existing code could be used and only the special aspects has to be implemented. By that way nothing gets broken. The code still using the basic class will run as before and for the special needs there is the derived class.
Reduce errors in your code
In OOP there is this principle called "Information Hiding". It means that only the necessary methods and properties of a class are visible from outside. This principle helps a lot to reduce errors. The reason for this is partly that internal variables could no longer be altered by accident. There is simply no way to change them except through the provided methods. Another reason is that the internal structure could be changed without the fear of side effects. The developer has only to ensure that the class behaves as before.
Accelerate the development process
The real fun starts if there are not only a few custom classes but a whole framework. So that the developer don't has to implement all the recurring tasks. All applications that we build at assono share the same framework. By that we can concentrate more on the domain model and the challenges of the application. Simple things as input validation, document history, refresh of dependent documents are only one line in our custom class.
Learn it now because it is used by nearly all modern programming languages
Beside the more concrete advantages there is another aspect not to be underestimated. All modern programming languages are object-oriented. Take Java, .Net or C++ and a lot of more. Experience you make now, will help with these programming languages. Even if you don't want to leave the beloved world of Lotus Notes. As soon as you want to write a custom plugin for Notes 8 you have to do it object-oriented in Java.
This might sound a little bit overdone. But object-oriented programming is more than just learning a new syntax. It changes the way you look at application development. It's a more holistic approach which integrates data and functions from the domain model.