开发者

Resources to successfully making applications scriptable [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 4 years ago.

Improve this question

In the process of designing an application we've come to the conclusion that the user needs to be available to add custom behaviour to the program and we want to allow this through scripting, however, none of us got any experience embedding a scripting engine in an application and even less designing the application to successfully allow the scripting to place.

We suppose that the key to making the application scriptable is to create a larg开发者_StackOverflowe set of events that the scripts can respond to, as well as exposing functions for the script to use. Instead of rushing into scripting recklessly we would prefer reading up on some resources on the topic.

We're looking for resources (preferably books) which covers the process of designing an application for scripting. Any advice would be awesome as well. More or less any advice on the topic would be nice.

If details of the project in question is needed just say so an I'll add a paragraph explaining more in-depth detail.


How techy do you want to make your scripting?

If your users are happy to use .Net then this artice gives an introduction to making an extensible application.

http://www.developerfusion.com/article/4529/using-net-to-make-your-application-scriptable/

When I was investigating a similar thing a while back I also found the technical notes for the sharpdevelop application to be very helpful.

http://www.icsharpcode.net/TechNotes/ProgramArchitecture.pdf http://damieng.com/blog/2007/11/08/dissecting-a-c-application-inside-sharpdevelop


Embedding scripting capabilities into an application will depend very much on the language and technology that make up the application. In your case, developing with C# there are some interesting options because of the work on the Dynamic Language Runtime. You should probably take a look at the IronRuby and IronPython projects since they will provide the best overall integration with .NET applications since they are themselves implementations of the Ruby and Python scripting languages on the .NET platform. As my experience centers on Ruby predominantly I would look at the information on hosting IronRuby in a .NET application.

As far as a general book goes I would probably start here: Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages. For specifics on IronPython there is this title from Manning: IronPython in Action. And for IronRuby there is this book still in Beta: IronRuby in Action.

This may also be a solid resource coming out of Microsoft's Professional Developer's Conference: Using Dynamic Languages to Build Scriptable Apps.


Can you wait for C# 4.0 and the DLR (or deploy the beta)?

See Application Extensibility and Embedded Scripting.


How hard this is really depends on your requirements. It can be quite easy.

In my app, I built a small set of classes that exposed the basic data model that I wanted to be made available to scripts. I built a scripting manager that creates an instance of the IronPython engine, adds an instance of the data model's root object as a global, and loads and executes the script.

Now, in my case, I'm actually the one doing all the scripting. So I don't need any kind of fancy development environment or testbed application, and I have essentially zero security considerations. The problem would be a lot harder if I needed to worry about any of those things.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜