views:

1862

answers:

12

[The only similar question I can find was answered long ago and contains a reference to mostly IronPython. I want to consider other options as well]

We have a complex data analysis application written in C#. The application should provide users with a sophisticated means of customizing their data analysis tasks. Currently, we use a mixture of configuration files and Excel tables to specify this, but it gets unwieldy, so we're looking for a scripting language to embed.

What's the best simple scripting language for C#/.NET embedding? Is it possible to somehow embed VBA similarly to Excel/Word? Or is perhaps JavaScript/Lua are used?

Needless to say, it should be easy to expose some API and objects from the main application into the embedded scripts.

+5  A: 

Boo perhaps?

Jon Skeet
How is it better than IronPython?
Eli Bendersky
@eliben: "better"? How is anything "better" than IronPython? It's different. It has optional static typing, and is very suitable for specifying DSLs which may fit your scenario nicely. See http://ayende.com/Blog/archive/2007/12/17/The-Boo-Language.aspx
orip
Yes, but it's fairly new, unsupported and obscure. There's no chance getting a book for it, the user community is small and there are not much libraries. My need is for a "corporate" application, after all, so Boo won't do.
Eli Bendersky
Book: http://www.manning.com/rahien/
Mauricio Scheffer
Libraries: it's a .NET language, so anything in the .NET world is yours.
Mauricio Scheffer
embedding it is *very* easy: http://boo.codehaus.org/Boo+as+an+embedded+scripting+language
Mauricio Scheffer
@eliben: In what way is Boo particularly "new"? The Boo manifesto is from ~2004, which is only a year later than IronPython. If you'd wanted something "better" than IronPython you should have defined your criteria explicitly. You said you wanted an option other than IronPython. I gave you one.
Jon Skeet
Jon Skeet - thanks for giving it. I'm just discussing this option. Hope it doesn't sound harsh - I'm glad for the links
Eli Bendersky
+1  A: 

I know you asked for a scripting technology, but the underlying need is code control for non-programmers. We're using ILOG Rules for .Net to meet that need.

David B
+5  A: 

I know the other question references IronPython, but I still feel like it should be here because I think it's one of the best options.

Another great option would be IronRuby. The main difference I see would be if your developers/users had any experience with either Python or Ruby that could be transferable.

Really, in the end your best option is going to be a language that is most easily adapted to by the users. Unless they accept it and are able to be more productive than they were with the old method it isn't worth the effort.

chills42
+1, in my experience Python is very easy to teach and to learn, and non-programmers take to it as nicely as heavy-duty programmers do.
orip
Python's easy to learn; using the .NET framework classes within IronPython is less so. But that's a problem you'll have with any scripting language that's interoperates with the framework, and you probablky don't want to use one that doesn't. I use IronPython and am very happy with the result.
Robert Rossney
+5  A: 

Lua is great! Lua play really nice with .NET. I wrote a blog post about how to get started embedding Lua and C#, might be worth to check out:

http://blog.apterainc.com/software/embedding-lua-and-c/

mmattax
A: 

Umm, how about C#? There's no reason why you cannot let the user write C#, then safely load it into another AppDomain with all the correct restrictions and safeguards.

Dmitri Nesteruk
Nope, C# is too wordly and complex for the users, I think
Eli Bendersky
+1  A: 

What about JScript.NET or PowerShell

CMS
+1  A: 

I would look into the XAML only Windows Workflow. You can rehost the designer, and provide custom activities that can be dragged out and used to manipulate the data in any way they like. VERY visual. I'm currently using this in one of my applications, and the users seem to love it. While there is a small learning curve to it, it is much less than a typical scripting language, and people seem to be able to grasp it fairly quickly, especially those with experience using flow charts and Visio.

Lusid
This can be very useful and user friendly if the required customization is fairly well defined and easy to parameterize. Otherwise you are back to providing a scripting language.
Larry Fix
I agree... but that is why you build generic activities to handle as many different processes as you need. Activities then take the place of individual language keyword structures, like if, while, etc.
Lusid
+1  A: 

I think using C# via CodeDom is very powerful solution

abatishchev
A: 

I also would put in a vote for using C# to write your extensions. Unless you have a compelling reason such as an existing user base already familiar with python, ruby, or boo, bringing in another language just adds complexity and training cost.

Jekke
A: 

There are many, many, many scripting languages. Which is best for you depends on what you're trying to do.

You should analyze the tasks your users need to do, the notation they are already familiar with, and pick an existing scripting language that matches them. You should not pick a popular scripting language then force your application and users to fit into it.

Dour High Arch
A: 

Boo and IronPython have been mentioned, but don't forget IronScheme, F#, or any of the other languages that have been ported to the CIL virtual machine and have runtime compiliation/interpretation.

Aaron
A: 

IronRuby is looking better everyday.

Eric Nicholson