views:

80

answers:

2

What factors do you weigh in your decision process when you select an embedded scripting, and can issues of configuration and variation be overcome purely with IOC and the Plugin pattern?

Many times the Strategy Pattern and Decorator Pattern are good way to tame variation in domain logic. The problem set I am faced with is that calculations and starting points of workflows will vary from through out the year based on different marketing campaigns, and not all data requirements and business rules are know until just before the campaign begins. Being a small shop we would like to have a solution where we can make configuration changes, test rigorously and yet not be forced to compile/link and re-deploy on a constant basis.

+3  A: 

Many times I have made internal data structures mutable through Python or Lua. Somtimes externalizing business logic into loadable modules. This makes your solution a reusable framework too that you can deploy to other clients cheaply. It also make 'in the field' fixes quicker (just update a text file) and gives clients freedom to modify their own dynamic data.

If you can safely expose the API without breaking things ... why not?

My two concerns are:

  1. Can I externalize logic that is specific to a client? or that might be tailored later?
  2. Can I do this whilst meeting performance and intellectual property constraints?

A clean framework == Reusable code and a platform you can quickly modify to solve problems of the same ilk without recoding.

Aiden Bell
That makes sense to me more and more lately. We use the Command Pattern, and as I see it this lends it self to a scripted configuration solution. Any reason to chose Python over CS Script? Thanks?
David Robbins
Depends on the application. I also mainly work in FOSS so Python and other FOSS languages fit into the toolchain quite well. Alot of the business logic is more than configuration, it is all parts of the framework that might be tailored (and don't need obfuscating for IP purposes)
Aiden Bell
+1  A: 

I've used this technique in 2 scenarios:

  1. I want to provide some facility for customers/clients to be able to provide some (limited) customisation themselves. e.g. to colour a chart red if a value exceeds 50, so allowing them to type a short script like "if val > limit then 'red'" etc. You have to be careful to limit what the user can program, however (for obvious reasons)
  2. When I need some customisation of the software in the field (i.e. recompilation isn't an option) and I know I'll need a little more than being able to turn components on/off. So I'll implement some mechanism where the application configures itself via scriptable components

(I'm mainly Java-based, so I'm using the Java 6 embedded scripting plus a variety of languages to achieve the above, depending on the focus)

Brian Agnew
Thanks. Have you done this in a Web environment where you did not have the luxury of bouncing the servers? (Yup - I'm from the .Net world where that's more common than I'd like!)
David Robbins
No. But certainly the Java implementations I've used don't require restarts to be able to run 'fresh' code. It's all very implementation dependent, I suspect
Brian Agnew