Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add programmability to my application

I'm writing an applicaton that is, at its core, a rules engine. The users want to be able to define custom rules. Some of these will be fairly simple algebraic expressions, many will involve some if-then branching logic, and some will be even more complex. What are my options for doing this?

My users are pretty smart, proficient at T-SQL and Excel commands, and generally familiar with programming constructs but they are not "programmers" per se.

I've thought about using VBA/VSTA; interoperating with Excel somehow; integrating some sort of scripting language (Ruby? Perl? Tcl?); or rolling my own.

In the best of all possible worlds, I will give them an editor with color coding and IntelliSense-like interactive help, an immediate execution mode for testing and experimenting, and a step-thru debugger. They also need to be able to save, retrieve, edit, and execute their rules. Blazing speed is not essential.

My environment is Windows/.Net 3.5/C#

Any ideas?

like image 316
Sisiutl Avatar asked Jan 08 '10 19:01

Sisiutl


2 Answers

I'm not a windows person so my answers won't exactly suit your situation. I'd recommend embedding a full blown scripting language interpreter into your application. Expose some primitives (ie. the parts of your rule engine you want public) and then provide a full blown interpreter. I know that TCL, Python and Guile are designed to be embedded in this fashion. I'd personally recommend Python since Scheme (guile) is a little esoteric and TCL seems to be losing ground generally.

like image 144
Noufal Ibrahim Avatar answered Oct 21 '22 05:10

Noufal Ibrahim


Any implementation like that is full of risks. I'd start with the smallest possible set of customizations and then incrementally build up your capabilities from there.

Don't try to program all sorts of extensibilities into it at once, unless you already have lots of skill doing that. Pick one simple ability at a time - running standard SQL queries and returningg recordsets or whatever.

like image 44
Tad Donaghe Avatar answered Oct 21 '22 07:10

Tad Donaghe