muskee Posted March 6, 2017 Posted March 6, 2017 Is it better to have 1 long script with 5 different if statements or 5 different scripts? (the 5 scripts would be assigned to 5 different buttons, the long script would be assigned to every single button)
comment Posted March 6, 2017 Posted March 6, 2017 Some more details would be useful, esp. regarding the condition that the 5 If statements are supposed to enforce. I suspect a single script could be written without requiring multiple Ifs. In any case, the difference in performance will be most likely negligible.
muskee Posted March 6, 2017 Author Posted March 6, 2017 The purpose of the if statement is to see on what layout the user is in. Based on the layout then I do an export of the data found on said layout. I can do this with 5 different scripts or one long script, which way would you prefer? or maybe not necessarily with an if statement?
jbante Posted March 6, 2017 Posted March 6, 2017 How different is the export process for each layout? In other words, how much of the single-long-script version would live inside the If...Else If...Else branches vs. how much would be the same steps (configured the same way) running outside the If[] block? The more steps in common, the more sense it makes to have the one long script. The more different steps there are, the more it makes sense to have separate smaller scripts. There's also another option for how to break up the logic which might be worth considering: one script for each layout, and each of those scripts calls common sub-scripts for substantial chunks of steps that are exactly the same. I lean towards this approach when there are both large chunks of logic different between contexts, AND large chunks of logic in common.
Recommended Posts
This topic is 2817 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now