One of the hardest things to decide when building a toolkit like OpenSesame is when to be clever, and when not to be too clever. For example, there is functionality inside OpenSesame to render a view as a spreadsheet or a table, to render rich text in ODF format, to render an entire document as rich text and then render that in ODF, etc.
But what should the developer using this see? Let's start with the following variables, which we will assume are set to meaningful values:
Dim dc As OpenSesameDocument
Dim sp As OpenSesameSpreadsheet
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim view As NotesView
Dim rtitem As NotesRichTextItem
Dim rttable As NotesRichTextTable
Now, we could have code that allowed:
Call dc.AppendFromNotes(doc)
Call dc.AppendFromNotes(view)
Call dc.AppendFromNotes(rtitem)
Call dc.AppendFromNotes(rtdoclink)
The first would render the document with its form to rich text, then convert that to ODF and append it to the OpenSesameDocument; the second would render the view as an ODF table and append it; the third would convert the rich text field to ODF and append it; and the fourth would convert the doclink to a Notes URL link and append it. Alternatively, we could have code such as:
rtitem = dc.RenderFromNotesDocument(doc)
Call dc.AppendRTItem(rtitem)
rtitem = dc.RenderFromNotesView(view)
Call dc.AppendRTItem(rtitem)
Call dc.AppendRTItem(rtitem)
Call dc.AppendDoclink(rtdoclink)
Less clever, but perhaps less prone to confusion. Also, is somebody going to be upset because
Call dc.AppendFromNotes(db)
doesn't work because they assume that any Notes object will work? Conversely, will people only have seen one of these and not figure out that others will work. If you have only ever seen:
Call dc.AppendFromNotes(rtitem)
you might never think to try
Call dc.AppendFromNotes(view)
but if you see the list of methods with
rtitem = dc.RenderFromNotesView(view)
you will figure out it is there. What do you think?
Copyright © 2007 Genii Software Ltd.
Tags: OpenSesame ODF