I’m starting a new xPage project. A little early to start writing code but I’m laying the foundations after gathering some requirements and sketching an architecture.
Perhaps you’d be interested in my foundations and you might have some you could suggest….
Layout – This is for internal use and I’m going to use the Extension Library Application Layout Control
Managed Beans – I like them, and the first one I’m adding is called Constants. I use this one in application scope to hold values for view names etc unless they would be better placed in a configuration document. Managed Beans are good use them.
Scoped variables – keep a track of them. Think about when you should remove them from longer lived scope.
Create a configuration document mechanism – You shouldn’t design a system where you the designer have to edit code to change email addresses, locations/replica id’s, Logging levels etc
Logging – Use logging from day 1, it’s harder to retrofit and easier to get into the habit of using it as you code. Use your own or OpenLog. I like to create logging levels, and be able to change them from a configuration document. Provided I’ve placed logging in all the right places I can elevate the level to see what’s going on in the application as it’s running if there are issues or lower them so that only errors are logged.
On the subject of errors – handle them! If the user needs to know about an error control the way they are displayed but don’t allow them to see an “unexpected runtime error” page. If you think about error handling from the beginning, establish a pattern for handling error and apply that consistently you will reduce the possibility of users seeing your bad coding.
Server Page Persistence (App Properties XPages tab) – I’m choosing “Keep the current page in memory”
Garbage in is garbage in – validate user inputs on the client side and server side.
Lifecycles are important – you understood the various events in traditional Notes form design. The xPage lifecycle is no less important.
Buy & dip into or read the three IBM Press xPage Books:
Turn off “Build Automatically” from the Projects menu in designer as there are unintended consequences – see Paul Withers excellent investigation
I’m sure there are more I’ll post them here but I’m convinced imposing a discipline on yourself to lay good foundations and build on those will stand your application and you in good stead.