top tips every notes developer needs to know

65
JMP102 The Top Things All New IBM Lotus Domino Developers Need To Know Kathy Brown | Application Developer Thomas “Duffbert” Duff | Application Developer

Upload: kathy-brown

Post on 05-Dec-2014

500 views

Category:

Documents


4 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Top Tips Every Notes Developer Needs To Know

JMP102 The Top Things All New IBM Lotus Domino Developers Need To KnowKathy Brown | Application DeveloperThomas “Duffbert” Duff | Application Developer

Page 2: Top Tips Every Notes Developer Needs To Know

2

Agenda● Coding Best Practices● Application Architecture

● Languages and Features

● Learning

● User Interface

● Everything Else

Page 3: Top Tips Every Notes Developer Needs To Know

3

For the love of all that is holy...Option Declare

Page 4: Top Tips Every Notes Developer Needs To Know

4

OR

prevents...

Page 5: Top Tips Every Notes Developer Needs To Know

5

Page 6: Top Tips Every Notes Developer Needs To Know

6

Comment Your Code(even the Matrix will have errors somewhere...)

Page 7: Top Tips Every Notes Developer Needs To Know

Better than nothing...

... Better still

Page 8: Top Tips Every Notes Developer Needs To Know

File > Preferences >

Domino Designer > LotusScript Editor >

Comment Templates

Page 9: Top Tips Every Notes Developer Needs To Know

9

Error Handling... do it!

Page 10: Top Tips Every Notes Developer Needs To Know

10

Example #1

Page 11: Top Tips Every Notes Developer Needs To Know

11

Option PublicOption DeclareUse "OpenLogFunctions"

Sub Initialize

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) ' <insert your agent code here>

Call LogEvent("Purge Older Than 4 Months Agent Ended", SEVERITY_LOW, Nothing) Exit Sub

logError: Call LogError Exit Sub

End Sub

Example #2OpenLog

Page 12: Top Tips Every Notes Developer Needs To Know

12

All it takes are these two libraries to give you what you see below...

Page 13: Top Tips Every Notes Developer Needs To Know

13

Thank you, Julian Robichaux, for OpenLoghttp://www.openntf.org/projects/pmt.nsf/ProjectLookup/OpenLog

Page 14: Top Tips Every Notes Developer Needs To Know

14

No Hard Coding... EVER!

Page 15: Top Tips Every Notes Developer Needs To Know

15

Users never change their minds, right?

Can you change “Mommie Dearest” to “Mommy Dearest” in all field options?

Jones made partner. We’ve changed the company name. Again.

Page 16: Top Tips Every Notes Developer Needs To Know

16

Good code can be re-used

Page 17: Top Tips Every Notes Developer Needs To Know

17

Hard coding Server Names -

It's the opposite of that sports slogan,

Just Don't Do It.

(we'll explain why later...)

Page 18: Top Tips Every Notes Developer Needs To Know

18

Test, Test, Test!

Page 19: Top Tips Every Notes Developer Needs To Know

19

●Things to consider: Print statements in LotusScript

@Prompt statements in Formula

alert() in JavaScript

LotusScript debugger (more to follow on that)

Don't test your own code

Test edge cases

Load test... with more than 20 documents!

Unfortunately, no xUnit for Notes...

Page 20: Top Tips Every Notes Developer Needs To Know

20

Use the LotusScript Debugger(it is your friend!)

Page 21: Top Tips Every Notes Developer Needs To Know

21

Agenda● Coding Best Practices

● Application Architecture

● Languages and Features

● Learning

● User Interface

● Everything Else

Page 22: Top Tips Every Notes Developer Needs To Know

22

Plan for Replication, Clustering, and Save Conflicts

Page 23: Top Tips Every Notes Developer Needs To Know

23

Server names?Local replicas?

Sequential numbering? (Just say no!)

Page 24: Top Tips Every Notes Developer Needs To Know

24

Understand Business Requirements

Page 25: Top Tips Every Notes Developer Needs To Know
Page 26: Top Tips Every Notes Developer Needs To Know

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

Page 27: Top Tips Every Notes Developer Needs To Know

27

Agenda● Coding Best Practices

● Application Architecture

● Languages and Features

● Learning

● User Interface

● Everything Else

Page 28: Top Tips Every Notes Developer Needs To Know

28

n:=0; @While (n > 1; Im:=gonna give you up)

Page 29: Top Tips Every Notes Developer Needs To Know

29

VS.

VS.No Thanks!

Page 30: Top Tips Every Notes Developer Needs To Know

30

' 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. Const NotesMacro$ = "@Sum(NumberList) / @Elements(NumberList)" 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

● You can use @Formula in Lotusscript with Evaluate

Remember this line...

● And you can use @Formula in Xpages with SSJS!

Page 31: Top Tips Every Notes Developer Needs To Know

31

LotusScript Is Not Scary

Page 32: Top Tips Every Notes Developer Needs To Know

32

Page 33: Top Tips Every Notes Developer Needs To Know

33

DXL Is Not Scary

Page 34: Top Tips Every Notes Developer Needs To Know

34

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 not have 100% fidelity, so you could lose important data from your datab...

Page 35: Top Tips Every Notes Developer Needs To Know

35

Layers Are Not Scary

Page 36: Top Tips Every Notes Developer Needs To Know

36

Page 37: Top Tips Every Notes Developer Needs To Know

37

Agenda● Coding Best Practices

● Application Architecture

● Languages and Features

● Learning

● User Interface

● Everything Else

Page 38: Top Tips Every Notes Developer Needs To Know

38

Help! I Need Somebody!HELP!

Page 39: Top Tips Every Notes Developer Needs To Know

39

Help! I Need Somebody!

It doesn't matter how many years you've been developing... F1 Help from Domino Designer is your best-est friend...

Page 40: Top Tips Every Notes Developer Needs To Know

40

Help Is Just a Click Away!

Page 41: Top Tips Every Notes Developer Needs To Know

41

Resources:PlanetLotus - http://www.planetlotus.org

OpenNTF – http://www.openntf.org

Twitter - http://www.twitter.com

DeveloperWorks - http://www.ibm.com/developerworks

Domino Designer Wiki - http://www-10.lotus.com/ldd/ddwiki.nsf

Martin Scott Domino Supersearch -

http://www.martinscott.com/dominosupersearch2.nsf/search?openform

Lotus Discussion Forums -

http://www.ibm.com/developerworks/lotus/community/#publicforums

Domino KnowledgeBase - http://www-01.ibm.com/support/search.wss?

rs=463&tc=SSKTMJ&q=&loc=en-us

JUST ASK!

Page 42: Top Tips Every Notes Developer Needs To Know

42

Page 43: Top Tips Every Notes Developer Needs To Know

43

Agenda● Coding Best Practices

● Application Architecture

● Languages and Features

● Learning

● User Interface

● Everything Else

Page 44: Top Tips Every Notes Developer Needs To Know

44

It's Important

Page 45: Top Tips Every Notes Developer Needs To Know

45

Important: Developers (plumbers) generally aren't very good designers (painters)

Page 46: Top Tips Every Notes Developer Needs To Know

46

So Easy, Even a N00b Can Do It!

Page 47: Top Tips Every Notes Developer Needs To Know
Page 48: Top Tips Every Notes Developer Needs To Know

48

Low Fidelity Prototyping

Page 49: Top Tips Every Notes Developer Needs To Know
Page 50: Top Tips Every Notes Developer Needs To Know

50

Agenda● Coding Best Practices

● Application Architecture

● Languages and Features

● Learning

● User Interface

● Everything Else

Page 51: Top Tips Every Notes Developer Needs To Know

51

Basic Understanding Of Admin Concepts

Page 52: Top Tips Every Notes Developer Needs To Know

52

Page 53: Top Tips Every Notes Developer Needs To Know

53

Document Everything

Page 54: Top Tips Every Notes Developer Needs To Know

54

Document the business requirements

Document changes to the business requirements

Document your proposed solution to the business

requirements

Document acceptance/rejection from both you and

the client of proposed solution

Document time projections

Document changes to requirements made after time

projections

Document anything and everything you can think of

Page 55: Top Tips Every Notes Developer Needs To Know

55

Change Control Process

Page 56: Top Tips Every Notes Developer Needs To Know

56

Security Through Obscurity...is not security

Page 57: Top Tips Every Notes Developer Needs To Know

57

You may be familiar with the ACL, but keep in mind that many design elements have security too.

Page 58: Top Tips Every Notes Developer Needs To Know

58

Reader Fields

A Double-Edged Sword

Page 59: Top Tips Every Notes Developer Needs To Know

Readers fields can...

Restrict users access

Span more than one field

Negatively affect performance

Page 60: Top Tips Every Notes Developer Needs To Know

Watch name formatsDon't let users modify

Always have a back door

Gotchas...

Page 61: Top Tips Every Notes Developer Needs To Know

61

Understand Basic Performance Tuning

Page 62: Top Tips Every Notes Developer Needs To Know

62

●SO many things you can look for...● ● GetNthDocument vs GetNextDocument● ● NoCache on @DbLookups● ● AutoUpdate on views● ● Repeated @DbLookups● ● Refreshing form on each field● ● View indexing● ● @Today in views (@Now also)● ● @IsResponseDoc vs. @AllDescendents

Page 63: Top Tips Every Notes Developer Needs To Know

63

Talk to Papa

Page 64: Top Tips Every Notes Developer Needs To Know

Question and Answer Time!

Don't forget to turn in your session evaluations! This was session JMP102 – Top Things All New Notes and Domino Developers Need To Know

Contact Information:

Kathy Brown - [email protected]: Running Notes - http://www.runningnotes.netTwitter: kjbrown13

Thomas “Duffbert” Duff - [email protected]: Duffbert's Random Musings - http://www.duffbert.comTwitter: duffbert

Page 65: Top Tips Every Notes Developer Needs To Know

65

●Legal Disclaimer● © IBM Corporation 2009. All Rights Reserved.

●The information contained in this publication is provided for informational purposes only. While efforts were made to verify the completeness and accuracy of the information contained in this publication, it is provided AS IS without warranty of any kind, express or implied. In addition, this information is based on IBM’s current product plans and strategy, which are subject to change by IBM without notice. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this publication or any other materials. Nothing contained in this publication is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software.

●References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or capabilities referenced in this presentation may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth or other results.

●Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.

●IBM, the IBM logo, Lotus, Lotus Notes, Notes, Domino, Quickr, Sametime, WebSphere, UC2, PartnerWorld and Lotusphere are trademarks of International Business Machines Corporation in the United States, other countries, or both. Unyte is a trademark of WebDialogs, Inc., in the United States, other countries, or both.

●Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.

●Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both.

●UNIX is a registered trademark of The Open Group in the United States and other countries.

●Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.●Other company, product, or service names may be trademarks or service marks of others.