0 Replies Latest reply on Apr 4, 2017 12:45 PM by TonyWhite

    Finding and removing unused Script Steps

    TonyWhite

      One of the things that is useful to a clean and happy FileMaker system is finding and removing unused objects, for example unused Script Steps.

      Here is an blog post that is useful background on renaming FileMaker objects without breaking code...
      http://nyfmp.org/2011/09/26/renaming-filemaker-code-objects-without-breaking-code/
      (Removing object safely requires some of the same understanding, guidelines, and constraints as renaming.)

      Here is an interesting and challenging use case...

      Most of us have scripts in our systems that are called with a script parameter fed into an If...Else If...End If script step structure.

      For example, you might have a script named Email_BTN_P that is called from multiple buttons with different script parameters.

      Often, over time, some of the buttons and their associated parameters are removed from layouts and, as a result, some of the Else If branches are no longer called/used. This could be considered technical debt.

      In some cases, it is worth it to pay down the technical debt by removing the unused code.

      The easier it is to find and remove the unused Else If branches...the higher the return on investment from the time and effort required.

      The goal is to be able to do the following:

      • Identify one or more scripts that take a parameter and that might have unused Else If branches.
      • Determine which of the Else If branches are NOT called.

      The scope of the problem:

      • System could be multi-file
      • External script calls (including plug-ins, FMP URL Protocol, etc.) are not part of the scope. These are tracked separately. 

      We have done this in the past as part of system clean up projects. While the methods that we used worked...they were not that easy to implement and took more time than they might have. While this is not something that we do every day, a cleanup of this nature is something that we find useful to do from time to time.

      Here is a thread What questions do *you* ask of a DDR? that I have cross-posted to, that reminded me of this need.

      The purpose of this separate thread is to focus on this specific developer need and not hijack the other thread.

      Do any of the current analytical tools directly address this need at this time? (If not perhaps a feature could added)

      Thoughts?

      Tony White
      Tony White Designs, Inc.