Scripting language for embedding into C#/.NET applications? [closed]
Asked Answered
C

12

14

[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.

Couch answered 20/1, 2009 at 17:42 Comment(1)
Have you checked out SILK? It was designed for that purpose.Nopar
U
11

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.

Urbannal answered 20/1, 2009 at 17:48 Comment(2)
+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.Armbruster
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.Tara
M
8

Boo perhaps?

Merola answered 20/1, 2009 at 17:43 Comment(8)
How is it better than IronPython?Couch
@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 ayende.com/Blog/archive/2007/12/17/The-Boo-Language.aspxArmbruster
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.Couch
Book: manning.com/rahienMotorcar
Libraries: it's a .NET language, so anything in the .NET world is yours.Motorcar
embedding it is very easy: boo.codehaus.org/Boo+as+an+embedded+scripting+languageMotorcar
@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.Merola
Jon Skeet - thanks for giving it. I'm just discussing this option. Hope it doesn't sound harsh - I'm glad for the linksCouch
D
6

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/

Drosophila answered 20/1, 2009 at 17:49 Comment(2)
Ugh! I'm getting a 404 on your link.Bloxberg
This is why stackoverflow requires that the contents of a link that pertain to an answer to be included in that answer (to avoid dead links).Footgear
H
3

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.

Hyperboloid answered 20/1, 2009 at 18:2 Comment(2)
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.Slung
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.Hyperboloid
L
2

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.

Lianna answered 20/1, 2009 at 17:46 Comment(0)
M
2

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.

Mccarthy answered 20/1, 2009 at 17:50 Comment(1)
Nope, C# is too wordly and complex for the users, I thinkCouch
E
2

What about JScript.NET or PowerShell

Exceptionable answered 20/1, 2009 at 17:51 Comment(0)
K
2

I think using C# via CodeDom is very powerful solution

Knurled answered 20/1, 2009 at 18:3 Comment(0)
T
2

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.

Thermochemistry answered 28/1, 2009 at 21:56 Comment(0)
C
2

IronRuby is looking better everyday.

Curlew answered 5/8, 2009 at 18:13 Comment(0)
P
1

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.

Podium answered 20/1, 2009 at 18:5 Comment(0)
F
0

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.

Fiedling answered 20/1, 2009 at 18:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.