Strategy Design Pattern -- *dynamic* !!!

Posted by alexeypro on Stack Overflow See other posts from Stack Overflow or by alexeypro
Published on 2011-02-19T07:14:40Z Indexed on 2011/02/19 7:25 UTC
Read the original article Hit count: 409

Filed under:
|
|
|
|

My application will have different strategies for my objects. What's the best way of implementing that? I would really love the case when we can make strategy classes implementation dynamically loaded from, say, some relational database. Not sure how do that better, though. What's the best approach? Idea is that say we want to apply to object MyObj strategy Strategy123 then we just load from database by ID 123 the object, deserialize it, get the Strategy class, and use it with MyObj. The maintenance while sounds easier from the first look can be a pain in the long run if Strategy interfaces changes, etc. What can I do also? I want to find solution when I should be keeping Strategy classes in codebase -- just for the sake that I don't need code change and re-deployment of the application if my Strategy changes, or I add new strategy. Please advise!

© Stack Overflow or respective owner

Related posts about java

Related posts about sql