Your Development & Design Resource
Domino URL Schemas for Domino CRUD API READ States
06/04/2009 12:59:00 PM by Chris Toohey
I posted a question yesterday across the various social networks (Facebook,
MySpace, Twitter, LinkedIn, BrightKite, etc.) asking the following:
Do you prefer db/view/doc or db/doc?open&UNID=X architecture for the front-end of the Domino CRUD API & web development?
... and I got some amazing feedback. Before I go into the feedback on the idea - which I'll admit 140 characters didn't quite do justice - I'll elaborate.
Every Domino Web Application Developer has used the db/view/notesdocument URL Schema for accessing a NotesDocument in a Domino-based NotesDatabase. That's the standard usage scenario. It's what we have all been taught. It's how Domino RAD drives us to develop.
But I'm curious... is there a better way? Specifically, does the
db/Page_or_Form?open&UNID=X URL Schema, when combined with
@GetDocField, lend to a
better NotesDocument and NotesData access scenario?
No, I haven't done benchmark testing yet on this, but avoiding a View Design Element that does nothing at times but add bloat to a NotesDatabase - to me - is just one of the many potential benefits to this approach.
Now, a few things that people brought up and that I think definitely should be mentioned:
This can impact/break URL Walking
Simply put, you can't delete the NotesDocument and expect to see the View.
Most Domino Web Application Usage Experiences warrant Views
... so why not just use the View.
This can impact URL Permalinking
Basing the URL up a NotesDocument UNID is easy, but it breaks any permalinking functionality, which can cause problems for bookmarking content or Search Engine Optimization.
Now, I have an address for each of these items:
This really depends on the expected usage experience. Do I want to return - potentially - a listing of all content if I navigate away from a specific content entry (NotesDocument)? Depending on the application, I might not want to. As for this "breaking", you can handle a missing UNID and where to redirect in that event in the design architecture.
Again, depends on what you need the application to do. For an application like Email, this meta-viewing of entries makes sense. For an application like a requisition, helpdesk, or jobs database, I don't think you'd want to return the customer back to a listing of all entries.
As far as rendering a NotesDocumentCollection in the UI, some could argue that unless there is a continuous update on View Entry contents, using a View can be unnecessary overhead. For example, if I were to render an entire "View Index" into a single NotesDocument as JSON and return those contents, I'm getting the exact functionality I would require without that overhead... but I'm getting ahead of myself here.
- This... this I'm working on.
For that last one, consider a technique that I've mentioned in the past (Nathan T. Freeman's Andrew's Allusion (or Creating Primary Keys in
NSFs)), where with db/Page_or_Form?open&UNID=X, X is
something like index.html. The content - when created - is assigned a
plain-text UNID by the customer (ie., index.html). Post submission,
the NotesDocument UNID is set to
"(":")":":";""). This hash - for those curious - would result in a
completely valid UNID (3A8A735F029991B9844D181AE297DDDE).
But I'm again getting ahead of myself.
Back to the original question: which method works best? I personally think
that - once you have a handle on the UNID,
return a NotesDocument much faster than lookup via NotesView.
Why? Well, consider this:
When you access a NotesDocument by it's UNID from the Web Browser Client via the db/view/UNID URL schema, the view simply becomes a placeholder, and is quite frankly ignored. Next time you see a Domino Web Application that uses this UNID URL schema, replace the view with either a 0 (zero) or thisviewdoesnotexist. Both will result in the NotesDocument being rendered. The View however is considered for things like Form Formula etc., as long as you don't use a zero or a non-existing element name.
I dunno, that sounds more dangerous to me than breaking the URL Walking and could potentially be another feather in the cap for the db/Page_or_Form?open&UNID=X URL Schema.
But like I said, I've yet to do any real benchmarking on this to see which is indeed faster or weigh the true benefits of one approach over another. For that, I'll open up the comments. Weigh in and let us know what you're thinking. If we get enough interest, I'll update the Understanding the Domino CRUD API Example Database to use both techniques.