top tips every notes developer needs to know

Download Top Tips Every Notes Developer Needs To Know

Post on 05-Dec-2014




4 download

Embed Size (px)




  • 1. JMP102 The Top Things All New IBM LotusDomino Developers Need To KnowKathy Brown | Application DeveloperThomas Duffbert Duff | Application Developer
  • 2. Agenda Coding Best Practices Application Architecture Languages and Features Learning User Interface Everything Else 2
  • 3. For the love of all that is holy... Option Declare3
  • 4. OR prevents...4
  • 5. 5
  • 6. Comment Your Code(even the Matrix will have errors somewhere...) 6
  • 7. Better than nothing... ... Better still
  • 8. File > Preferences > Domino Designer > LotusScript Editor > Comment Templates
  • 9. Error Handling... do it!9
  • 10. Example #110
  • 11. Option PublicOption DeclareUse "OpenLogFunctions"Sub Initialize Example #2 OpenLog Dim session As New NotesSession Dim dbThis As NotesDatabase Dim viewThis As NotesView Dim docThis As NotesDocument Dim dtCutoffDate As NotesDateTime Dim varCutoffDate As Variant On Error Goto logError Call LogEvent("Purge Older Than 4 Months Agent Started", SEVERITY_LOW, Nothing) Call LogEvent("Purge Older Than 4 Months Agent Ended", SEVERITY_LOW, Nothing) Exit SublogError: Call LogError Exit SubEnd Sub 11
  • 12. All it takes are these two libraries to give you what you see below...12
  • 13. Thank you, Julian Robichaux, for OpenLog 13
  • 14. No Hard Coding...EVER! 14
  • 15. Users never change their minds, right? Can you change Mommie Dearest to Mommy Dearest Jones made partner. in all field options? Weve changed the company name. Again. 15
  • 16. Good code can be re-used 16
  • 17. Hard coding Server Names -Its the opposite of that sports slogan,Just Dont Do It. (well explain why later...) 17
  • 18. Test, Test, Test! 18
  • 19. Things to consider: Print statements in LotusScript @Prompt statements in Formula alert() in JavaScript LotusScript debugger (more to follow on that) Dont test your own code Test edge cases Load test... with more than 20 documents! Unfortunately, no xUnit for Notes... 19
  • 20. Use the LotusScript Debugger (it is your friend!) 20
  • 21. Agenda Coding Best Practices Application Architecture Languages and Features Learning User Interface Everything Else 21
  • 22. Plan for Replication, Clustering, and Save Conflicts 22
  • 23. Server names? Local replicas? Sequential numbering? (Just say no!)23
  • 24. Understand Business Requirements 24
  • 25. Things to Consider Purpose of project Who are the key players of the project? Who are the end users? Length of time given to complete project
  • 26. Agenda Coding Best Practices Application Architecture Languages and Features Learning User Interface Everything Else 27
  • 27. n:=0;@While (n > 1; Im:=gonna give you up) 28
  • 28. VS. VS. No Thanks!29
  • 29. You can use @Formula in Lotusscript with Evaluate For each document in a Notes database, use a Notes macro to compute the average for a list of numeric entries in the NumberList field. Evaluate returns a Variant, and Notes macros return an array. In this case, the array contains only 1 element (element 0). For more info, see the Notes documentation. Sub Click(Source As Button) The macro text must be known at compile time.Remember Const NotesMacro$ = "@Sum(NumberList) / @Elements(NumberList)"this line... Dim result As Variant, j As Integer Dim db As New NotesDatabase("", "MYSALES.NSF") Dim dc As NotesDocumentCollection Dim doc As NotesDocument Set dc = db.AllDocuments For j% = 1 To dc.Count Set doc = dc.GetNthDocument(j%) result = Evaluate(NotesMacro$, doc) MessageBox("Average is " & result(0)) Next End Sub And you can use @Formula in Xpages with SSJS! 30
  • 30. LotusScript Is Not Scary 31
  • 31. 32
  • 32. DXL Is Not Scary 33
  • 33. DXL lets you view data and design elements in XML format. You can export, transform, and import that XML into and out of your Notes database... Imagine changing all the occurrences of a font name or some other design element by doing a Find/Replace!But be careful!DXL does nothave 100%fidelity, so youcould loseimportant datafrom yourdatab... 34
  • 34. Layers AreNot Scary 35
  • 35.