[jboss-user] [JBoss Seam] - Re: Quick entity question

ellenzhao do-not-reply at jboss.com
Mon Jul 23 06:54:42 EDT 2007


I wanted @In for entity beans too!

http://www.jboss.com/index.html?module=bb&op=viewtopic&t=114111

I watched the Rod presentation. In fact rich domain model is already pretty easy to do with Seam. (With the @In support in entity class, it would be even more  convenient)
  
Rich Domain Model, The Seam Way:

Seam has out-of-box support for Drools, you can write a rule base for any entity class and use the entity's own rule base for its "rich model behaviour".  This way, an entity is a totally self-contained knowledge base/expert system, it simply "knows" how to do any "rich behaviour", provided that the "how" knowledge is stored in the rule base.  The rule bases can be authored in many dialects, you can author it in Java/MVEL/whatever you like, as long as there is an adapter in the drools compiler....And services can be declared in .drl files as global so any services can be used whenever entities need them. Days ago when I was refactoring my application in this way and showed a bit code to Mark Procter, he said it was the dummiest design he had ever seen, and said I'm better off with Groovy if I just want to write bean methods. But Mark, after investigating Groovy during the weekend, so far I'm not discouraged to bind a rule base to each entity. Because things like closure in Groovy is in fact rules applied to data.  (Mark was extremely busy releasing Drools 4.0 GA these days, he worked almost 24/7, so I should be blamed to disturb him at such a chaotic moment....). Yes, Rete-based rule engine is only best suitable for many object/many pattern matching problem, but my entity happens to have several collections and there are some complex inter-entity pattern matching when I want an entity to "behave" something..... And please do not forget now there is the Drools Business Rules Management System out there.....Rules/Knowledge management is easier for programmers than before.....In my opinion, in fact an entity only needs to hook up two things: A database and a rule base. Database to store the "atom" properties and a rule base to store the rules of how to orchestrating different services to perform a certain entity behaviour (eg: for the Vet entity bean: rule "render myself using jsf" .... , rule "register microchip" ....). Since services are global in these rule bases, it can be really easy to change a service itself and not modifying all the rules code..... It can be a totally stupid idea, I'm also learning and just _started_ this experiment, any constructive critics and discussion are most welcome! :-) 



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066597#4066597

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066597




More information about the jboss-user mailing list