# FileMaker Fail Early

**URL:** <https://the.fmsoup.org/t/filemaker-fail-early/4128>\
**Category:** Floating Topics\
**Created:** [May 18, 2024, 4:22pm UTC](https://the.fmsoup.org/t/filemaker-fail-early/4128 "2024-05-18T16:22:05Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![tonywhitelive](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/tonywhitelive/32/208_2.png) [@tonywhitelive](https://the.fmsoup.org/u/tonywhitelive)\
**Post date:** [May 18, 2024, 4:22pm UTC](https://the.fmsoup.org/t/filemaker-fail-early/4128/1 "2024-05-18T16:22:05Z")

</div>

There is a principal in software design called "Fail Early”, "Fail Fast", or "Fail Early, Fail Fast”. For this post, I am going to use the term “FileMaker Fail Early” to share some thoughts about how this principal applies to FileMaker software development...

Let us look at the common use case where a user clicks a Button on a Layout that runs a Script. For the Script to succeed, there might be a number of conditions that must be true, for example, there might be:

- Object Names that the Script references
- Fields that must be empty (or not empty)
- Related records that must be present (or not present)
- Required Plugin(s) (with versions)
- Feel free to add your favorites below
- Users privileges. // thanks @harvest
- Hidden errors that show up when you commit record // thanks @mrwatson-de
- Share points are mounted // new, from yours truly

A “FileMaker Fail Early” strategy lets us keep our Script as simple as possible by failing (dare I say Halt Script'ing) before we change state...

1. Layout
2. Window(s)
3. Found Set
4. Etc.

…and then needing to "clean up".

We are polishing and updating our “FileMaker Fail Early” Scripts. Below is one:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/fmsoup/original/2X/8/8e5018e795ef73fc4c9af170592f0ada5f81eff1.png)

1. Which of the 3 lines do you prefer: 8, 9, or 10?
2. What do you think of the Script name?
3. Other thoughts?

Considering that we put this Script in almost every File, how would you comment?

- Comment each section in the script in-line
- Single line comment at the top
- Let the Script name be the comment
- Link to a web page that documents all the “ **FileMaker Fail Early** ” Scripts
- Other?

This post is, in part, a followup on this presentation  
DIGFM: Code Review, ♫ It's Getting Better All the Time ♬ (5/9/2024)  
[https://www.youtube.com/watch?v=oPZ\_sJHVHVM&t=2288s](https://www.youtube.com/watch?v=oPZ_sJHVHVM&t=2288s)

The goal of the presentation was to show some good code and some bad code...easy to do if you [don't] think about it 😉

"Failure is an option” — unless you are watching a movie

---

_[View the full topic](https://the.fmsoup.org/t/filemaker-fail-early/4128)._
