Old dog, new tricks

Without wishing to sound like an arrogant twonk (but I suppose I will), I found myself somewhat disgruntled recently when I heard I would be required to code a Notes database. “Gah! Not another one!” No-one wants to be a Monkey-Programmer-Boy after all. So, the thing had to be done, and life had to be made interesting. Here’s how I did it:

  • OOP. You knew I was going to mention that, didn’t you? :-) Yes, I decided to do some object oriented stuff with some of the more challenging (and not so challenging) Lotusscript. I’m really glad I did too… a FormValidator class made quick work of the application’s — frankly twisted — validation requirements.
  • More OOP: I also got around to something I’ve been meaning to write for ages: a LinkedArray class. I’m not too keen on much of the in-built array functionality in Lotusscript (mainly referring to R5 here), so I finally did something about it. The end result is a nifty custom class that allows me to confidently tinker with arrays: check for duplicate elements, add elements, remove elements, insert elements, re-order them, and so on. Gr-r-r-rreat it is. I found myself using it all over the place, meaning far less spaghetti code.
  • Test-based coding. Whilst creating the aforementioned classes I used simple agents right from the get-go to test each piece of code as I went along. This was a real revelation, and not too tedious to do. For example, code like this was handy for testing my LinkedArray, and adding the asString property was very useful (this simply expresses the array as a flat string with a specified delimiter):
	Dim LA As New LinkedArray(Null)
	Dim i As Integer

	LA.add "Winkle"
	LA.add "Fe"
	LA.add "Fir"
	LA.add "Fo"
	LA.add "Fum"

	Msgbox LA.asString(" ")

	i = LA.getIndex("Fo")
	Msgbox "i is " & i

	LA.insert "Gah", 3
	Msgbox LA.asString(" ")

I’ll write more about my experiences should anyone find this useful, but in the meantime, please feel free to chip in with your ideas!


  1. Ben,

    Re. your array class. Kanngard has also written a good "vector" class, amoungst other things.


  2. Ben, if you ain't doing MPB stuff (you lucky fish), what are you working on these days? Colin Pretorius#
  3. Mainly my coffee drinking skills :-)Ben Poole#
  4. i'm actually having a hard time lately writing lotusscript code that isn't OO. i've got the bug!

    like the sound of that class, give it up willya?

  5. Ben: project management? :-PColin Pretorius#
  6. I really like the sound of test based development. Particularly if it leaves me with a kind of jUnit kind of test harness for the Business Logic of the application. This would be just dandy for integration testing n'all. Trouble is that in most Domino applications you can't really use too much lotusscript beacuse the agent manager will kill you. I struggled with Kent Beck's book but there is some good stuff at www.testdriven.comSpug-Me-Not#
  7. Agreed Spug-meister, you don’t want loads of agents everywhere. But in the testing / dev cycle that’s OK.

    Colin, no, haven’t turned to the dark side ;-) This was just the first “greenfield” Notes development I’ve done in ages. Most stuff for me now is tinkering, managing others and Java coding.Ben Poole#
  8. For a JUnit-like environment, check out LSUnit at:
    It needs to be run through Altavistas babelfish, but I successfully converted it to a R5 unit testing framework.

    - JohanJohan Känngård#
  9. I think I see a problem with the test - "Fir" should surely be "Fi".. :-)

    Seriously good fun, isnt it. Our iDM stuff is now about 120 classes, etc, etc. And this is the only way you can really deal with the stuff.

    As a rule of thumb, we generally end up writing as much test code as we do actual code.. Which isnt very good, but does mean that the unit testing works well.

    Mmm. A linkedArray class. nice. Especially if it reads and writes directly to and from document items..

    ---* BillWild Bill#
  10. Well-spotted Bill [9] ;-) The LinkedArray is still being tinkered-with… a few more methods would be nice, then I might expose the soft-white underbelly of my code to wider scrutiny. It’s about time, haven’t posted anything useful in ages!

    Whenever I muck around with arrays I always fret about Redims and whether I should be using Lists.

    Johan [8], interesting link - however, if it’s LSUnit you’re after, check out Nik Shenoy’s site: Poole#

Comments on this post are now closed.


I’m a software architect / developer / general IT wrangler specialising in web, mobile web and middleware using things like node.js, Java, C#, PHP, HTML5 and more.

Best described as a simpleton, but kindly. You can read more here.