Upload
db-services
View
1.209
Download
7
Embed Size (px)
Citation preview
SCRIPTING BEST PRACTICESEmory BrownApplication Developerhttps://www.dbservices.com
Questions
If you have a question, please typist it into the console. If we
don’t get to your question, please send it to [email protected]
About You
About DB Services
•We are a team of analysts, developers, and designers creating custom applications to make your organization more effective and efficient. Learn more about our FileMaker services on our website.
•If you leave this presentation wanting learn more! Check out our FileMaker Blog where we post new content each month.
•To learn more about DB Services, check out our website at www.dbservices.com
Background
Work
Read more on me on our website, https://www.dbservices.com/, in the About section
• Application Developer atDB Services
• Certified in 15, 14,13, 12, 11• Working with FileMaker for 6 years• Sponsor at FileMaker Developer
Conference
• Member of FM Academy• Global presence (Canada, Europe,
Africa, South America)• Team focused on adding value
Scripting
When coding, choose two:• It works• Easy to read• Quick to write
Conventions help make code that works, faster to read and write.
Time Saving
Humans are the most expensive part of theapplication development cycle. • Template• Conventions• Scannable Code
Proper Context
Ensure script is run from intended contexts• Saves time testing• Create fewer bugs• Generic scripts
Error-Trapping Scripts
Three useful sub-scripts to consider in every script• Halt of not in browse mode• Halt if no records in found set• Commit record and halt if invalid*
Error-Trapping
Why Error trap?• Empower users• Speed up troubleshooting• Create user trust
**Don’t make generic error messages
Allow User Abort [Off]
Doesn’t make sense for users to be able to escape a script.
Set Error Capture [On]
Detailed error messaging empowers the user andhelps the developer troubleshoot
Exit Script Step
Error-Trapping
What to trap for• New Record• Delete Record• Set field• Go to related record*• Interacting with systems outside of FileMaker
Commenting
Not all comments are created equal• Readability• Clarity• Scannability
Commenting
Readability• Housekeeping• Section Headers• Spacing• Notations
No Comments
Minimal Spacing
Too Many
Clear Sections
Commenting
Clarity vs Noise• Anything being used in a non-
conventional way*• Stacked objects• Sort script steps*
Hidden/Stacked Objects
Commenting
Most important thing is DOING IT• Update comments as you code• Create a template script with
sections
Modular Code
Pros & Cons• Can save time testing or updating• Can also add time to later updates• Don’t over-engineer
Too Much
*Inconsistant
Too Much
Complex Code
Ziptastic API
Evaluate
Evaluate
Dangers of Evaluate( )• Tempts you to hardcode field names• Slower than native code• Security risks
Tips & Tricks
Script Debugger• Step-Into debugger• Turn off script trigger button
Naming Code
How to name variables well• Self-describing noun• Unique name• NO right answer
Q&A