I’m looking for best practices or a general approach towards making a server-side application modifiable by regular non-programmers. It doesn’t have to be hot-modified; it can be recompiled and redeployed.
Suppose the system is in a EJB or Spring container. The system is message driven (perhaps EJB3.1). There are a number of POJOs that receive messages from client applications (RCPs or RIAs), react to those messages, and send more messages to the same and other client apps. What is the best approach to make the system easily modifiable? If I correctly separate the server’s logic components, what technology or design approach would allow me to swap out logic POJOs with new POJOs, thereby changing the application’s behavior?
I think what I’m describing is a Strategy Pattern. Can these POJOs be generated from a set of human-readable and editable rules? Is a rule engine like Drools the right way to approach this problem?
Can this be combined with a state machine generator as well, so that each state has a list of input messages and responses to each, transition rules, and so forth?
Toy example:
- State_Evening
- input sellStocks
- reply “Cannot sell in evening, wait until daytime.”
- input sellStocks
- State_Day
- input sellStocks
- do SellStocks
- reply “Stocks sold for _“
- input sellStocks
etc.
Now that I write it out like that, it looks like the scripting language would be almost the same as programming…
I’m just looking for a pointer in the right direction. Or it could be that I’m over-complicating something simple. Perhaps I should just make the business logic as cleanly separated as possible and make the changes in the code?
Edited on Feb 22 2012 for clarity
I agree to JB Nizet comment about the scalpel.
Anyway: some answers to your probelm:
EJB will not work this way, they will need a EJB Container like Glassfish or Websphere Application Server. But if you use Spring, then you do not need EJBs (you have Spring Beans instead). If you use Spring, then you mostly have one Spring Servlet, and all the web stuff is handled by the Spring MVC Framework — this divers from classis Servelt programming (without framework)
One way to change some code on the fly is using a scripting language. So you can use for example Rino to run java script code within the JVM.
But really, when I would need to do your job, then I would try to implement some framework for server and client, that make it easy to write the games in java. So your studends can use a normal IDE and maybe maven to deploy the complete application.