PreviousNext…

On Karl-Henry’s frustrations…

In a weird synchronicity, Karl-Henry Martinsson has just posted about some frustrations he’s been having with Domino Designer (I haven’t added the “Eclipse” bit to the end of “Domino Designer” because (a) I know Maureen doesn’t like it :-), and (b) because this issue affects Designer 7 too). So how does one get to this sad state of affairs?

The dutiful developer performs a “compile all” in their database, and is shocked to see a whole load of Lotusscript Error - Syntax Error reports in the compiler window. Whilst the compiler is probably pointing to a load of forms in one’s app (yeah, that’s helpful), the issue is actually with the shared action design element. You know, that bastard anomaly of a design note in Designer, whereby things that look like multiple design elements (shared action buttons)… aren’t (I hates it so I does, hates the shared actions element. Can you tell?)

I encountered this very issue earlier this week in a Notes client application I was performing some maintenance on, and it took me a while to track down. The offending action scripts were referencing some files that must have been stored on the previous developer’s machine, and Designer was not happy at all. As I found to my cost, Option Declare will not fix this issue. Nor will editing and re-saving the offending elements. One has no choice but to go through the code, find the errors and resolve them. The compiler gives little, if any, assistance at this stage.

My solution—which to my mind makes for far better coding practice anyway—is to rip out all the Lotusscript from such shared actions, and stick these routines in a separate library. You then reference these routines from the shared action buttons, and we never talk of this again. Moving the code solves a few things in one fell swoop:

  1. Shared actions are all stored in one note in the NSF. If this note corrupts (and they do), you lose all that code
  2. Storing all significant Lotusscript in one part of the application design (i.e. in script libraries) makes far more sense from a maintenance point of view
  3. When editing Lotusscript in a script library, the compiler behaves itself and tells you about any problems. In shared actions, you’ll be lucky

So what do you know. 2011, and I’m still doing the odd Lotusscript tip… ;-)

Comments

  1. Yeah script libraries. My agents also all follow this simple pattern:
    Option Declare
    Use xxx
    Sub Initialise
    Call agXXX
    End Sub

    Life is so much simpler if you just code in Libraries... like Design Synopsis actually has a chance of succeding to find references, when it doesn't go bust because the references are scattered through tons of forms, subforms, views, actions etc etc...Lars Berntrop-Bos#
  2. What is wrong with shared actions? Just bang your head on the keyboard and save the results. There is no syntax checking of shared actions until run time. 'Use' a script library instead.John Kingsley#
  3. My frustration with the designer recently has been how unstable it is. Code that worked in version 8.02 and lower now does not work and crashes the designer and the client. The Java client is that much more complex and results are a higher number of bugs. Also Java has its memory issues. Richard Moy#
  4. Shared actions is almost a good idea. I always put the code in libraries because of a nasty problem when removing them.

    The nasty problem is, for some idiotic, reason Domino actually puts a copy of the action code from the shared action in the view / form or where ever you use it. So, even though you think you're centralising your code, you're inadvertently laying little time bombs.

    Why are the time bombs ? Well, lets say you delete the shared action at a later date. Now, even though you have deleted it centrally, the action does not disappear from the form/view where you used it. It in fact remains fully functional and in the parent design element where you use it. Now you have to goto each element and delete it manually. On a DB with a 50 views and 20 forms....Great! Just farkin great!

    Here is the kicker, if you don't delete them manually after removing the shared action, the copy that it does use locally in the design element (form/view), is in fact the original version of the shared action when first installed. So you could even introduce regression bugs into actions that you haven't successfully removed.. Now, that's double jeopardy, beat that one Watson.....
    Giulio#

Comments on this post are now closed.

About

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.

";