Top
  • XPages Blog
  • Resources
  • FAQ
  • Contact Us
  • About
Search

Categories
  • Development (25)
  • General (13)
  • Tips and Tricks (17)
  • Tutorial (18)
Tags
  • @DbColumn (1)
  • @DbLookup (1)
  • 851 (4)
  • ACL (1)
  • Advanced (5)
  • blog content (1)
  • Bugs (4)
  • Categories (1)
  • Ccustom controls (1)
  • charts (1)
  • Code Snippets (3)
  • compatibility (1)
  • Components (1)
  • Controls (3)
  • CSS (5)
  • custom controls (4)
  • data source (2)
  • Data Table (1)
  • Deployment (1)
  • dojo (2)
  • DXL (1)
  • Dynamic Controls (3)
  • events (1)
  • Example (1)
  • Fix Pack (1)
  • Frameworks (1)
  • getSubmittedValue() (1)
  • getting started (1)
  • getValue() (1)
  • IamLug (1)
  • inline editing (1)
  • introduction (2)
  • javabean (1)
  • JSF (1)
  • Login (2)
  • management (1)
  • new to xpages (1)
  • Notes in Nine (2)
  • Notice (1)
  • page title (1)
  • Partial Updates (2)
  • Performance (1)
  • postopendocument (1)
  • Presentation (1)
  • repeat controls (1)
  • Resource (1)
  • ScreenCast (4)
  • SNTT (5)
  • Style Sheets (1)
  • Themes (5)
  • Training (1)
  • validation (1)
  • video (3)
  • View (1)
  • what's new (1)
  • Wiki (1)
  • wiring (1)
  • xhtml (1)
  • XML (2)
  • XPage (1)
  • XPage Workshop (1)
  • XPages (8)
  • XPages in the Client (2)
  • xpages questions (1)
  • XSLT (3)
  • XSP (1)
Archives
  • November 2009 (1)
  • October 2009 (11)
  • September 2009 (8)
  • August 2009 (10)
  • July 2009 (37)
Recent Entries
  • XPages: Taking The Next Step
  • Prototype versus Closure in SSJS
  • XPages heading to New York City!
  • Adding the Ability to Watch for ANY Partial Refresh in an XPage
  • XPages Using Domino Designer Course Updated for 8.5.1
  • XPages - The Good, The Bad, and The Ugly - A Final Word
  • What's New For XPages in 8.5.1
  • XPages | Things to be aware of when using an 851 Designer with a 85 Domino server
  • In-line Editing on a Conventional XPages Data Table
  • Notes In Nine - 007 - A License to TypeAhead
Latest Comments
  • November 1 - Karsten Lehmann on Prototype versus Closure in SSJS
  • November 1 - Dan Sickles on Prototype versus Closure in SSJS
  • November 1 - Nathan T. Freeman on Prototype versus Closure in SSJS
  • November 1 - Dan Sickles on Prototype versus Closure in SSJS
  • November 1 - Nathan T. Freeman on Prototype versus Closure in SSJS
  • November 1 - Peter Presnell on Prototype versus Closure in SSJS
  • November 1 - Karsten Lehmann on Prototype versus Closure in SSJS
  • November 1 - Nathan T. Freeman on Prototype versus Closure in SSJS
  • November 1 - Nathan T. Freeman on Prototype versus Closure in SSJS
  • November 1 - Nathan T. Freeman on Prototype versus Closure in SSJS
Latest FAQ's
  • July 12 - Bruce Elgort
    What are XPages?
  • July 12 - Bruce Elgort
    Where can I download a trial version of IBM Lotus Domino 8.5?
  • July 12 - Bruce Elgort
    What version of IBM Lotus Domino is required in order to run XPages?
RSS
  • XPages Blog RSS
  • XPages Blog Comments RSS
Linkage
  • Bruce Elgort's Blog
  • David Leedy's Blog
  • Declan Lynch's Blog
  • Jeremy Hodge's Blog
  • John Mackey's Blog
  • Julian Buss's Blog
  • Matt White's Blog
  • Paul Hannan's Twitter
  • Peter Presnell's Blog
  • Steve Castledine's Blog
  • Login
Sunday
01Nov2009

XPages: Taking The Next Step

spacer Sunday, November 1, 2009 at 1:11PM

A common theme in my blogs about XPages has been the challenges that come in learning how to develop XPages.  I have made numerous remarks about the on-line documentation and the importance of community contributions to fill that void.  If you or your company has the money there are also some excellent resources such as the TLC courses on XPages and JavaScript.  There are also a great many books on JavaScript and Dojo that are immense value for learning some key aspects of XPages.  These are all great to get you started. 

At the end of the day there is no substitute for sitting down and writing an XPage application.  My suggestion here is not merely to start building something based upon what XPages can do.  (A solution in search of a problem).  It is often better to start with a specific need and then meet and confront the challenges of implementing that problem using XPages.  This is how I have started to get a more solid understanding of XPages and how it can be applied to what I am called upon the do as a Notes developer.  This usually leads to a solution.  Not necessarily a great solution.  It is unlikely to be the sort of code you would hope to be writing in a few years time, or even your next XPages project!  But it is an important start.

So what comes next?  If you are like me and have been programming in Notes for a while it may feel like your first XPage application has been written using crayons.  As a professional developer you need to quickly develop a kitbag of acceptable best practice for XPages so you can start copying code from application into another with confidence the code is well written, robust, and efficient.  So how do you take those first applications scrawled in crayon and turn them into masterpieces?  To take that next step I look to the gurus in the field and then try and observe very closely what they do and how they do it.  Everyone will have there own views who the XPage gurus are.  I am reluctant to mention any in case I offend those I forget to mention.  But the people on my short-list include my fellow bloggers here at The XPages Blog plus Tim Tripconny and Nathan Freeman et al at Lotus911.  Not all these people are providing free access to all the XPage applications they are building but you can:-

  1. Read their blogs and look closely at the code examples.  The comments often provide as much insight as the blog;
  2. View applications they have built that are available on-line; and
  3. View their contributions on OpenNTF.

Applications to look at closely include:-

  1. IQJam - Probably the most sophisticated and impressive application I have seen so far built using Xpages.  This is a commercial product but you can probably get some idea how it is built by looking at the code Elguji have posted for TaskJam.
  2. XTalk - So you've all read the 54 part series on learning Xpages.  Now take a look at what Declan finally developed with this great example of an XPage application Declan has kindly added as an OpenNTF project.
  3. XPages Wiki - Steve Castledine and Niklas Hedloff are two of IBM's leading application developers and this OpenNTF project provides some insight into how IBM code Xpage applications.
  4. XPages Framework - Another contribution from Steve & Niklas at IBM worth a close look.

Please feel free to add to this list with comments

Look closely at the code in these projects and compare them with your own.  Look for ideas on how you can refactor your code to better implement best practice.  Once you have done this you will have a much sounder base from which to build project #2, #3, #4, ....

Note: If you are keen to get your hands dirty with XPages but your employer does not have enough (any?) XPage projects for you to work on, you should seriously consider getting involved with one or more OpenNTF projects.  If you are presently "between contracts" or even "between jobs" it is probably even more important as a way to bolster your resume with a skill that is still in short supply.  Discussion NextGen is a perfect example of a project with an XPage component in which you can not only get your feet wet, but you will also be working directly with IBM.

spacer Peter Presnell | spacer Post a Comment | spacer Share Article
Friday
30Oct2009

Prototype versus Closure in SSJS

spacer Friday, October 30, 2009 at 9:17PM

JavaScript is an Object-Oriented programming language.  While languages such as LotusScript, Java, and C# use classes, Javascript (including SSJS) uses objects in a form of OOP known as Prototype-based programming.  Inheritance is one of the key features of OOP.  There are two techniques that can be  used to implement Inheritance within JavaScript.  These are commonly known as Closure and Prototype.  Both techniques construct objects by defining a function and then assigning the function to a variable using the new statement.  Where these techniques differ is the process by which Inheritance is implemented to add properties/methods.

Note: At this time properties are not supported in JavaScript and are typically supported by creating a pair of get and set methods.

Closure

With Closure methods are defined inside the parent object.

// Cartesian Coordinates - Closure implementation
function CartesianC(x, y)
{
  this.x = x;
  this.y = y; }
  this.getX = function()
    {
    return this.x;
    }
}

Closures allow a developer to define all the methods up front in much the same way that classes are typically built.

Prototype

In contrast, prototyping adds methods using the special prototype statement to effectively extend the existing object.

// Cartesian Coordinates - Prototype implementation
function CartesianP(x, y)
{
  this.x = x;
  this.y = y;
}
CartesianP.prototype.getX = function()
{
  return this.x;
}

Prototype maximizes the flexibilty of JavaScript making it possible to add additonal methods at any stage. 

Closure versus Prototype

Given there are two ways to implement inheritance, which one should we use?  Well in client-sided Javascript it is generally held that Prototype is the superior choice.  While I have heard some people suggest that prototype is a "hack", it is in fact the default way to implement inheritence and is described in the ECMAScript standard.  There has been a lot written on the subject and most people seem to side with Prototype.  The reasons include:- the code runs faster; consumes less memory; and the objects are more easily extended.

In contrast there is little written so far on the topic for SSJS.  Given the SSJS code is implemented a little differently I decided to do a few tests to compare the performance of the two options.  If you visit my Web site at www.dominoframework.com and look under "XPages Kindergarten" you will find an entry for Closure v Prototype (note: There are issues with ie and digit trees so use a decent browser!).  Here you can test the code out yourself.  The results were somewhat inconclusive.

The bottom line is that there is perhaps no compelling reason to use one over the other.  It most likely comes down to personal preference.  Despite this, I am presently siding with Prototype within my own xDomino Framework.  The key reason being it matches the style of the JavaScript language.  The key strength of JavaScript is the flexibility of the language.  That is part of the reason I see it as such a good fit for Lotus Notes.  Implementing inherence through Prototype magnifies flexibility.

Note: There is at least one compelling reason to use Closures within SSJS.  At present the SSJS Editor in DDE does not recognize the prototype statement for what it is and hence the methods it creates do not show up in the outline as methods of the parent object.  This makes navigation of SSJS the same nightmare LotusScript was prior to ELSE (EclipseLotuSScript Editor).

spacer Peter Presnell | spacer 15 Comments | spacer Share Article
Friday
30Oct2009

XPages heading to New York City!

spacer Friday, October 30, 2009 at 4:56AM

In New York City, on November 9th, I'll be at the Tri State Lotus User Group presenting a session on XPages.

Xpages: After the Introduction

You've heard about XPages and maybe even read a blog post or two, but where do you really start? Why dip you're toe in the water when you can dive right in? This session will help you establish a comfort zone with XPages. See how to take your existing knowledge of the Notes Client to the next level. Demos allow you to walk through an application that uses Type Aheads, Validation, Repeat controls and more! See how to achieve good functionality with relatively little code to write - just don't tell your boss!

If you like any of my Notes in 9 screencasts you'll hopefully get a feel for what to expect.  I like to think of that is "Notes in 9 - Live and in person!". 

The great thing about the day, is that there's something for everyone.  Check out the fantastic Agenda!

Hope to see you there!

spacer David Leedy | spacer Post a Comment | spacer Share Article
tagged spacer Notice in spacer General
Thursday
29Oct2009

Adding the Ability to Watch for ANY Partial Refresh in an XPage

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.