Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have a .NET project at work that provides a couple of (Iron)Python scripts to the customers, to allow them to customize the output of the program. The application generates code for certain machines, and supports a couple of different formats.

Until recently, we only provided a script for one format. We're expanding upon that to include support for the others. If the user is using a script, they select their input script before generating the output code. A script designed for Format1 output is going to cause errors if they're trying to generate Format2 output. I need to deal with this.

One option would just be to let the customers use common sense, and if they load the wrong script it will just fail, or worse, produce inaccurate data. I'm inclined to provide a little more protection than that.

At the moment I'm considering putting a shebang-style comment line at the top of the script, ala:

# OUTPUT - Format1

If the user tries to run a Format2 process with a Format1 script, it will warn them. Alternatively I could create different file extensions for the input scripts that vary by type.

The file-type comment approach helps prevent the script from actually loading improperly, at the cost of failing to warn the user until they've already selected it, via a dialog box. Using different file extensions would allow me to cut down on visual clutter when providing a File Dialog, but doesn't actually stop them from loading the wrong script.

So I'm really not sure if the right approach is to just leave it alone, or provide some safeguards.

share|improve this question

migrated from ux.stackexchange.com Jun 2 '12 at 10:15

This question came from our site for user experience researchers and experts.

add comment

1 Answer 1

up vote 0 down vote accepted

Well, no one is answering, so I suppose I'll say what we ended up doing. We ended up putting a programmatic check in the script that ensures the process passed has the correct identifying attribute (in this case, an Enum, which IronPython can compare as a string). If a process with the wrong identifying Enum is passed the script will warn the user and terminate.

Nothing prevents the user from deleting that check from their own script. The same could be said for changing the file extensions or writing a shebang-type line. Nevertheless, it does seem to get the job done without putting in too much effort.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.