Humans are ill-equiped to model complex worlds, data structures, and processes in memory (as we must do everyday while we are programming). Fortunately for us, several generations of hackers and computer scientists have developed practices to improve software quality, increase code reuse, and improve programmer efficiency. In this session, I review the most relevant of those practices and the way those ideas can be applied to improve programming in FileMaker Pro.
FileMaker Developer Conference 2010: Small Things | Loosely Joined
1. FileMaker Developer Conference 2010
Session COR010
Small Things | Loosely Joined
Lessons Learned to Improve Quality,
Reuse Code, and Program Efficiently)
Dr. Don Levan
Vanguard Custom Software
2. Who am I?
• President, Vanguard Custom Software
• FileMaker 7, 8, 9, 10 Certified Developer
• Licensed Clinical Psychologist
• Former Photojournalist
• Founder of the “Craft of FileMaker” Seminar Series
2
3. Please See the handout (on the CD):
vanguardcs.net/devcon
You will find:
Summary of the
problem
Key points
References
Information about the
“Craft of FileMaker”
Seminar Series
20. INCREASING TRANSPARENCY: BY NAMING WELL
Field Names:
Lowercase and underscore.
No punctuation other than underscore. No Periods.
No spaces.
Boolean: Use a form of the verb “to be” or “to have”,
such as “is_customer” or “has_children”.
Example: first_name
Tekserve FileMaker & MySQL Conventions (2009)
21. INCREASING TRANSPARENCY: BY NAMING WELL
Variable Names:
Use a name that clearly communicates intent.
Follow the convention for field names.
Example: $report_type
Tekserve FileMaker & MySQL Conventions (2009)
22. INCREASING TRANSPARENCY: BY NAMING WELL
Script Names:
Name scripts to describe their purpose.
Use active voice.
Add a parenthesis to indicate any parameters.
Example: Process payment ( entry; type; action)
Tekserve FileMaker & MySQL Conventions (2009)
23. SMALL THINGS: DO ONE THING WELL
The Unix Pipe: $ program_1 | program_2 | program_3
24. SMALL THINGS: DO ONE THING WELL
The Unix Pipe: $ history | grep “ssh -p”
26. LOOSELY JOINED PROGRAMS:
Do not repeat themselves (Dry).
Keep their variables as local as possible (Shy).
Break complex scripts into disconnected layers.
Pass in the data (Tell the other guy).
Expect the output of any script to be used by another.
27. LOOSELY JOINED PROGRAMS: UNIX PIPES
All Unix programs have multiple streams of information:
Standard Input
Standard Output
Standard Error
The pipe connects the Standard Output of one program
to the Standard input of another.
28. LOOSELY JOINED PROGRAMS: FILEMAKER PIPES
Unix FileMaker
Standard Input Get (ScriptParameter)
Standard Output Get (ScriptResult)
Standard Error Get (ScriptResult)
29. LOOSELY JOINED PROGRAMS: FILEMAKER PIPES
Main Script ( param_1; param_2)
Set up variables
Sub-Script ( param_1 )
Perform Script (pass parameters)
Return error & output
Set Variables to error and output
Sub-Script ( param_1 )
Perform Script (pass parameters)
Return error & output
Set Variables to error and output
Exit Script
(Return error & output)
30. Small Things | Loosely Joined
Case Study: Tekserve’s Payment Routines
(Re-factored)
46. FOLD KNOWLEDGE INTO DATA
Differentiate between data and program logic.
Separate the data out into script parameters, custom
functions, and table records.
Use SetFieldByname, Evaluate, and other functions to
simplify script logic.
50. Small Things | Loosely Joined
Fail Loudly
Fold Knowledge into Data
51. Small Things | Loosely Joined
Fail Loudly
Fold Knowledge into Data
52. Small Things | Loosely Joined
Fail Loudly
Fold Knowledge into Data
53. “The only way to write complex software that won’t
fall on its face is to hold its global complexity down –
build it out of simple parts connected by well-defined
interfaces, so that most problems are local and you
can have some hope of upgrading a part without
breaking the whole.”
The art of Unix Programming (p. 14)
54. FileMaker Developer Conference 2010
Web Update Page
www.filemaker.com/devcon/speaker_updates
(This is also listed in your conference binder)
This session WILL / WILL NOT
have updates.
13 Magazine Ad - Eddie Adams
Work with John Walther.
My craft as a photographer
Next: Same process as a programmer.
Main Problems:
Everything is always changing. Life, business, economy, environment. Software must bend or break.
We are limited:
Memory 7 +/- 2.
One Locus of Attention
Systems are inherently interconnected.
We are ill equipped to deal with complexity. - Gets big, then it gets buggy.
Started looking - Found Pragmatic Programmer
Led to Ruby, Rails, then Unix.
Found that Generations of hackers and scientists had already solved the main problems.
How to deal with change?
how to deal with our limitations?
how to keep systems form being overly coupled or connected?
The most relevant of those traditions to FileMaker is Unix.
How do you do it: How do you create systems that achieve the goals of the moment and are able to adapt to new needs and challenges.
We are going to examine each of these points, looking at the philosophies and practices of others.
HIred by Tekserve to Convert their 20 year system to 9
6 Months.
Next up, rewrite the payment system.
Old and ossified. Unable to change.
Holding back the business.
SHOW ONLY THE SAMPLE FILE WITH TECHNICAL DEBT
Keep this slide at the end of your presentation.
(Don't forget to remove this comment from the slide.)
Keep this slide at the end of your presentation.
(Don't forget to remove this comment from the slide.)