views:

176

answers:

1

The business I work for is an on-line retailer, I'm currently working on a project that among other things involves calculating the customer prices for products. We will probably create a service that looks something like...

public interface IPriceService
{
  decimal CalculateCustomerPrice(ISupplierPriceProvider product);
}

public interface ISupplierPriceProvider
{
    decimal SupplierPrice { get; }
    string Currency { get; }
}

Don't worry it will not look exactly like that, but you get the general idea. In our implementation of this service there will be a number of rules for calculating this price, these rules can change quite often and what we probably want to do sometime down the line is to create some sort of DSL for these rules. At the moment though we're not quite sure what changes will actually be requested by sales department and so forth so I'm thinking about hosting the DLR and having an Iron Python or Iron Ruby script file that contains a lot of the price calculation. This way we can rapidly update the price calculation rules and also get a feel for what type DSL the business people needs. Does this at all sound like a sane idea and also does anyone have any links articles/tutorials on how to host the DLR and letting the script files interact with CLR-objects and return values?

+1  A: 

It definitely sounds like a sane idea to me. You can trivially access CLR internals (objects and return values) from IronPython, I don't know about IronRuby. Chapters 1 and 7 of IronPython in Action are available online and would probably be helpful. There is also a "hello world" style tutorial available at the learning python blog.

Rick Copeland
Yay, I'm sane! ;-) Thank's for pointing me to these resources, I'll just by that e-book, it seems to include all I need to know. I've got the feeling that Ruby would be better for eventually creating a DSL though, but I know to little about both Ruby and Python.
Patrik Hägne