I'm not saying that factory method is an ideal solution, it's just easiest to demonstrate. As for the comparison with hotswap technique, scripting IMHO provides other benefits such as dynamic typing, closures, etc. Another benefit is that with this approach you can allow easy modifications without IDE which could be useful in many production environments.
The real world scenario I found the most appropriate is development of controller logic in MVC based web applications without compile/deploy cycles. You can find somewhat different support for scripting in Spring IoC container, where they force bean refreshing in certain period of time, where I prefer evaluate/compile approach. Unfortunately, I don't have any instantly usable code ready for public use, but I'll try to make it soon. |