Meet Domino Superior (or A Tutorial on Why Xpages Are Better Than Cake and Ice Cream)
Mutation: it is the key to our evolution. It has enabled us to evolve from a single-celled organism into the dominant species on the planet. This process is slow, and normally taking thousands and thousands of years. But every few hundred millennia, evolution leaps forward.- Patrick Stewart as Professor Charles Xavier
After spending three days in meetings and workshops in Westford, I would submit that for Domino, that leap forward has arrived. In the form of the now-ironically-named Xpages, the Yellowverse is going to get a lot of long-standing problems solved in a very short time. Much like learning to live with people that can walk through walls or read minds or shoot lasers from their eyes, it's going to require some getting used to. There will be prejudice, and a longing for the "old ways" and a few reactionaries will probably even want to do away with this new super-species of design. But those who embrace it will find themselves quickly getting back to building Super Human Software.
Today, I'm going to show you how Xpages can quickly solve one of the greatest long-standing problems in Domino development: the inability to do an @DbLookup in a view column -- otherwise known as "can't do JOINs."
Continued...
Let us start with a couple of simple, traditional Notes constructs. Here we have a view showing a list of mutants identified by Professor X's Cerebro. Note that we have only the name and alias for each of these homo superiors....
And here we have a view that shows a list of their mutant powers. There is only one power per document. This is far different from typical Domino architectures, where the list of powers would be a multi-value field inside the previous mutant document...
In Domino days of yore, the techniques to present these relationships are the stuff of legend. In the client, we've seen agents to merge & sync content, embedded views in preview windows, collapsed information written to environment variables, entire rewrites of presentation layers in Applets, forms that fake views by building tables on the fly, even entire DB2 implementations just to get SQLViews of Domino data! On the web, we've seen hand-coded HTML in agents, embedded Javascript that's executed client side to rewrite cell contents, client-side XML transforms, and even portal implementations to front-end Domino solely to group some information together in a table!
In Domino 8.5, Xpages makes this easy. Almost drag-and-drop easy. Here's how...
First, in Designer, you need to double-click on the Xpages category in the database navigator. Then click on New XPage. We're going to call ours "CerebroResults."
Then select View from the Container Controls palette, and drag that on to the blank Xpage. This will bring up the View wizard, which prompts you for the view to add. In this case, I'm selecting the Mutants view. That selection also causes the list of columns to appear. Note that you can select/deselect columns.
Once the view appears in the Xpage, it's automatically formatted as a table. You'll see the columns appear in the same order as they do in the view design. You are free to rearrange this.
Note: The additional circles in yellow show off some other great features of Xpages. The Outline on the left provides a continuous hierarchical perspective on the overall design of the Xpage, so you can see nesting relationships very easily. This also makes it easier to select some elements, instead of clicking on their borders in the editor. And the styling for the view panel allows us to specify many different units. And see that little diamond next to the Width property? That tells us that we can click there to set a computation for that property instead of a static value. You'll see those little diamonds EVERYWHERE.
Next, we select the view panel with the outline and in the properties pane, go down to the All Properties tab. This is the "advanced" tab that gives you access to everything you could possibly control. Not all of these things are surfaced in the other tabs. In this case, we scroll down to the data category, and select the property var. We can enter a value for the property that we'll call "mutantRow". In case it's not obvious, this will be the variable name for each entry generated by a row in the view.
Now we'll go back to the table and right-click on any column. It really doesn't matter which column you click -- you just want the context menu for the table as a whole. Choose Append Column from the bottom of the menu.
We set the label for the new column's Header to be "Powers." You'll note there's a separate Name for the Header. This is auto-generated by Designer, and there is a unique identifier for almost everything you ever see.
Then we click the Column itself, and again go to the All Properties tab. In data, we find a property for value. And fortunately for us, there's a little diamond next to it!
When the Script Editor comes up, the fun begins. You'll notice the language selection is JavaScript (Server Side). Yes, you get extensive server-side JS support. In fact, prepare to be amazed at how it works...
Note: You'll see some interesting options in the reference panel in yellow. Those scope references mean exactly what you think they mean. Xpages provide session and application scopes. No more profile documents for session tracking. Expect more on how to use these for caching goodness in later tutorials!
We'll enter our server-side Javascript here. You'll notice that this isn't particularly strict Javascript, right? "@DbLookup" isn't valid Javascript. It turns out that IBM doesn't want to force you to waste all that knowledge you've spent the last two decades amassing on Notes/Domino languages. So instead, they rewrote their Javascript interpreter to understand most of the common functions you use every day. In this case, @DbLookup works almost identically.
Note: the syntax is slightly different. You'll notice commas instead of semi-colons, and I'll let you know that the function names are case-sensitive. My number one suggestion for the workshop is that they need either much stronger syntax checking at design time, or way better debugging tools. The power in Xpages definitely force you to keep your wits about you!
You're almost done. Just jump back to the view panel in the outline again and set the width to 100 percent. I forgot to highlight that for you earlier! (See, even the tutorial does things in the random order that a dev really would!) Don't forget to SAVE!!!
Lastly, we'll go back to the Database Navigator and double-click on the Application Properties. Select the Launch tab in the editor. You might need to scroll over to the web launch properties. Set Launch to Open Designated Xpage and choose CerebroResults.
Okay! Now we're ready to open the NSF in a browser. Just open Firefox and voila!
You'll notice that the top has a next/previous navigator already, too. That wasn't automatic, but it was just one combobox away. Tune in next time to find out how that works!
And that's it!
Of course, this has dramatic implications for all of your existing applications. With the ability to do lookups in a column, every data architecture strategy we've used for the last 15 years is now obsolete. And if you're thinking "P'shaw! That has to be a major performance killer!" you couldn't be more wrong. It's actually stunningly fast, because the lookup in the Javascript is actually interpreted into a native Java API lookup, complete with cache management, and then evaluated by the server. In this example, I'm doing 20 lookups at a time, and the page comes up in the blink of an eye.
There are bugs (Philippe and I debugged one in his source control right there at the conference table on Wednesday) but that's why it's still beta.
The rumors are no exaggeration. Xpages are the next wave of Lotus evolution, and they will turn everything you know upside-down. Get ready to be a novice again.




Comments
"Get ready to be a novice again."
I'm looking forward to it - once Xpages have been *fully* deployed and become available to us Lotus Notes and Domino developers, the possibilities are truly endless.
Posted by Chris Toohey At 04:08:52 PM On 06/19/2008 | - Website - |
Great tutorial.
I remember being excited after the Xpages session at LS08. Now, I remember why. Those little diamonds by themselves are so exciting. And the "hybrid" JavaScript/Formula. That's the first time I saw that.
Question: How do Xpages render in the Notes client? (How does yours, above, for example?)
-- Grant
Posted by Grant Lindsay At 04:27:06 PM On 06/19/2008 | - Website - |
I'm pretty sure I'm not violating my NDA when I say that Xpages-in-the-Rich-Client is slated for "a future release."
Posted by Nathan T. Freeman At 04:29:09 PM On 06/19/2008 | - Website - |
And since it's all java underneath, you *might just be able* to "script" the Eclipse/Expeditor APIs too. How cool would that be?
I stand by my assertion that java will not (ever) be the primary application development language for Notes. Third party plugins? Sure. Huge, performance ciritcal apps? JS+Java.
Server side javascript is going to be big elsewhere too:
{ Link }
Posted by Dan Sickles At 04:46:56 PM On 06/19/2008 | - Website - |
That's why the @DbLookup stuff is so fast. There's no formula engine involved.
And please note, everyone, I am barely skipping across the surface of what's possible here. This is tutorial one in what well might be a series of 50 or so.
Posted by Nathan T. Freeman At 04:55:52 PM On 06/19/2008 | - Website - |
For the record, I suffer the B&D language daily...along with the baroque Eclipse APIs.
IBM could have used Rhino but there were licensing/distribution problems at least some of which went away when Sun shipped Rhino with Java6.
Lookg forward to your next 49 XPages tutorials
Posted by Dan Sickles At 05:58:40 PM On 06/19/2008 | - Website - |
John
Posted by John Mackey At 06:15:53 PM On 06/19/2008 | - Website - |
Did you know that you could also just write Java in the JS editor and it should work? :) That could come in handy sometime - mix and match @functions (really just JS functions with an @ in front), JS, and Java).
Chris
Posted by Chris Reckling At 10:55:34 PM On 06/19/2008 | - Website - |
Posted by Andrew Pollack At 01:00:52 AM On 06/20/2008 | - Website - |
Posted by Ben Poole At 03:55:31 AM On 06/20/2008 | - Website - |
Posted by Mark At 05:34:40 AM On 06/20/2008 | - Website - |
You mentioned this is planned "for a future release". I hope they don't wait too long with that. The only possibility to forgive IBM that they didn't do ANYTHING on the Notes core would be that we can do all our Notes apps with XPages then.
Posted by Julian Buss At 06:22:35 AM On 06/20/2008 | - Website - |
@10 - Dude, my boss reads this blog. NOT the right question to ask!
@12 - As I said, I'm under nondisclosure regarding client futures. Ask people you know at Lotus, though!
Posted by Nathan T. Freeman At 06:55:24 AM On 06/20/2008 | - Website - |
One of the great things about this for some companies will be that it doesn't require a corporate-wide deployment of Notes 8.5 to get the benefit. Just pick a few servers that to host critical web apps and put those on 8.5 and away you go. The benefits are so significant that I can't help but think some people will be forced to adapt this strategy when they normally would have waited 18 months or more.
Posted by Lance Spellman At 07:32:08 AM On 06/20/2008 | - Website - |
Posted by Karel At 07:32:42 AM On 06/20/2008 | - Website - |
* Mutant Registration didn't work out so well for the Marvel universe.
Okay, back to the real topic...
XPages both excite and bewilder me. I was stoked when I saw them at Lotusphere and went out of my way to get an opportunity to do as many UX sessions as I could. Mixing JS and formula felt a little weird, and as you said, there are a few syntactic differences so you can't just copy and paste code.
It is going to take A LOT of tinkering to find out all the interesting ways XPages can be used, and to come up with best practices. Hopefully IBM will produce heap big amounts of documentation and tutorials. Something like this would be ideal for me: { Link } .
Posted by Charles Robinson At 09:22:29 AM On 06/20/2008 | - Website - |
I hope that with the advances xPages bring to Domino can revive/start a new revolution for Domino development.
Posted by Bruce At 09:41:54 AM On 06/20/2008 | - Website - |
We're trying to get an idea of how you want the doc and tutorials delivered -
in the product doc? as cheat sheets? as example files? in a wiki?
Send your feedback to me at my-firstname UNDERSCORE my-lastname - and it's at us dot ibm dot com.
@nathan - thanks for being willing to return to novice - and for giving all the feedback you did at the workshop!
Posted by Chris Kergaravat At 10:16:46 AM On 06/20/2008 | - Website - |
Posted by Kerr At 11:01:29 AM On 06/20/2008 | - Website - |
Nice tut. Nathan! I'm getting fidgety to set this up on a server at home!!
Posted by Jerry Carter At 01:41:47 PM On 06/20/2008 | - Website - |
Posted by Andrew Pollack At 05:34:44 PM On 06/20/2008 | - Website - |
As I say, I hope not. Maybe XPages will reverse the trend and all those places that run Domino, but aren't investing in new apps, will change there mind. Maybe it'll draw in a new customers who have never used Domino before.
I hope so. I'm not holding my breath.
Posted by Kerr At 07:54:47 AM On 06/22/2008 | - Website - |
Im not amused.
Posted by jimmy bracco At 04:13:43 PM On 06/23/2008 | - Website - |
For example the diamond after 'label', can we use @Formala, JS or combinations everywhere??
Posted by Patrick Kwinten At 09:25:59 AM On 06/24/2008 | - Website - |
Posted by Chuck Savino At 12:58:35 PM On 06/24/2008 | - Website - |
Any luck for us semantic web folk, or am I asking for too much?
Posted by Samuel deHuszar Allen At 06:15:29 PM On 06/25/2008 | - Website - |
Yes, absolutely. There's something called a "repeat" control that will be the subject of my next tutorial. Basically, it's any controlled block that iterates over a data source. So you can build a custom DIV block per row in a view -- no tables involved whatsoever.
You'll love it. And it's totally Web 2.0.
Posted by Nathan T. Freeman At 09:27:32 PM On 06/25/2008 | - Website - |
I have to admit, I was ready to be disappointed, but now.... not so much. I look forward to your tut.
Posted by Samuel deHuszar Allen At 02:00:54 PM On 06/27/2008 | - Website - |
Posted by Harris Huckabee At 01:00:19 PM On 07/09/2008 | - Website - |
Posted by E.N. van Dorland At 01:50:39 AM On 07/27/2008 | - Website - |
All my problems with existing applications Domino seems that could be resolved with the new features in 8.5 forward I hope this release. I´m expected for this released
Posted by Milton Douglas At 04:36:20 PM On 07/28/2008 | - Website - |