Skip to main content
    Country/region select      Terms of use
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino


Once, I was involved in a project for which we sought a government grant -- known for short as OPM (Other People's Money).

The down side to OPM, is that when you take money from people they are likely to miss it. Given a choice, they might not have chosen to spend it the way you have in mind. Practically, it helps if you have a government on your side, because they have guns and police to imprison people who don't pony up. However, I find this process distasteful, and prefer not to participate in it.

Fortunately, this is less of a consideration when using OPP -- Other People's Programs. Many are available free of copyright (or under quite reasonable terms) and -- a key point -- unlike money, using them does not deprive anyone else of their use. And of course, not having to do the work yourself saves much time, thereby producing slack in bounteous quantities.

That's why I recommend to everyone doing development, that they invest some time becoming familiar with the sources of free and cheap software in their technical area. For Domino developers, the place to start out is Besides tips and code snippets, this site has many complete applications by top-notch developers, already debugged, refined and expanded through actual use. It's an amazing, indispensable resource. Open source development is a great way to get quality in your applications -- not only do you get the benefit of everyone else's in-the-field experience, but you can continue to look for updates as people post fixes to any remaining bugs that you didn't know you had. In no other system of software development can you get someone to debug your apps for free.

There's always a tradeoff, of course. It doesn't pay to spend an hour searching for a piece of code that you could have written yourself in 45 minutes. Nor does it make sense to start off with something whose resemblance to your desired result is so slight that you spend a lot of time reworking it and end up with convoluted logic or odds and ends of useless and potentially trouble-making stuff that you forgot to get rid of.

Weigh against that, however, the following:

  • I don't know whether it's true for you, but I find it's easy to underestimate the effort involved in an implementation. If you've ever done any remodeling in your home, you've probably had the experience of tearing open a wall only to discover some botched-up mess of pipes and wires that will cost you an extra week over what you thought. Writing code is like that -- you often don't know what you're getting into until you start in. And, like the plumbing project that you finished only to discover three weeks later has been leaking onto the floor of your cupboard, it's hard to know when you're really done. Prefab is the way to go.
  • The effort required to locate usable code is much less if you know where to look. I'm building a list of resource links on the right -- I know I've left out many excellent ones that people will remind me about in their comments. The Notes/Domino forums here on developerWorks also contain a lot of useful code.
  • Often, by searching you can find better code than you would have taken the trouble to write yourself. For performance reasons, I hate to use an exchange sort, but it's so easy to write compared to any of the better-performing algorithms. But if you know where to get these other algorithms, already translated into LotusScript, and done so as to be adaptable to whatever you're sorting, then you can get that performance edge. Plus, when your code is reviewed you don't have to blush at your primitive sorting technique.
  • To me, the mark of a professional developer is that they keep an archive of their own work and any useful snippets they've run across, so that when they need a routine to, let's say, take as input a GIF filename and return its width and height in pixels, they've got it right there and can locate it in about fifteen seconds. Here, it's not just a matter of saving time; I want to have fun in my work, and it's boring to write again the same piece of code that I wrote last year (or that I came across in someone's blog and now I can't remember whose), just because I can't remember which application I wrote it in and it's too much trouble to go find it.
snippets.gifI have two archives that I use for reusable code I write or steal from others. One of them, the Domino Design Library Examples, is posted in the Sandbox. The design is very old and could use updating, but it still works. This is my "heavy" archive, which I use for things that involve entire design elements or long instructions how to use them. I also have a "snippets" archive (shown here) based on Alan Lepofsky's useful "paste information" tool, where I store often-used subroutines or custom classes so that I can get them onto my clipboard in just a few clicks. Here's how that works: a toolbar icon in Domino Designer brings up a dialog where I can select an item from the library.

When I click OK, the toolbar formula opens the selected document, selects all, copies, and closes the document. Now the code is on the clipboard and I can copy it where I need it. The original Paste Information tool also pastes at the current cursor location, but this doesn't work in Designer because of differences in how focus is handled. The formula for the toolbar icon follows:

DBPATH := "codesnippets.nsf" ;
OPENKEY := "- open database -";

choicelist := @DbColumn("" : "ReCache" ; "" : DBPATH; "($All)" ; 0 );

dockey := @Prompt([OkCancelList] ; "Snippets" ; "Choose snippet to copy" ; "" ; choicelist: OPENKEY);

@If(dockey = OPENKEY;

@PostedCommand([FileOpenDatabase]; "":DBPATH);


@PostedCommand([FileOpenDatabase]; "":DBPATH; "($All)"; docKey; "0"; "1");


@PostedCommand([EditDocument]; "0");






Andre Guirard | 7 March 2007 10:11:00 AM ET | Plymouth, MN, USA | Comments (2)

Search this blog 


    About IBM Privacy Contact