当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: Many Java developers today have
 

 

 ·making fluid 3d creatures with jogl    »显示摘要«
    摘要: what has your gpu done for you today? most modern computers are equipped with a ridiculously fast chip thats dedicated to graphics processing, but java programs rarely get the chance to make it sing......
 ·introduction to tag unit, part 1    »显示摘要«
    摘要: jsp custom tags allow developers to abstract complex code out of a jsp page and into reusable components. jsp custom tags are not, however, standalone classes, and therefore cannot be fully tested ......


Does Your Project Need a Rule Engine @ JDJ

many java developers today have moved toward some form of logging and/or unit test framework, and their code has been purged of many system.out. println() statements that were the traditional approach. now perhaps its time to get rid of some of those if ( x ) {. . .} as well. nothing in a piece of code seems to foul up the design as much as the business logic, and going from two-tier to three-tier to n-tier hasnt done much to solve that problem.

in some dark layer of the code there is still a tangled mass of ifs, elses, and look-up tables upon which the whole thing rests. after a project goes through a few generations of developers, the "business rule" layer becomes a gordian knot that defies both change and comprehension. rule engines offer a framework for isolating the business logic in your applications; this framework is simpler and more flexible than look-up tables. as a design approach, it fits java programs of almost every conceivable form, purpose, and budget. most important, it brings the elusive goal of code reuse a step closer. this article lays the foundation for getting started using a rule engine on your own project.

what is a rule engine?

a rule engine is a system for applying some set of if/then rules to the data in a system and then taking some action on the data or the system itself. its primary purpose is to separate the business logic from the system logic - to externalize the business logic so it can be maintained separately. use a rule engine to separate the if/then rules from system code - to externalize them so they can be maintained separately from the system code. the behavior of the system can then be modified without changing code or needing to recompile/redeploy. rules are stored in human-readable form in a file so they can be changed with a text editor or rule editor.

for example, a typical storefront system might involve code to calculate a discount:

if (product.quantity > 100) { product.discount = 2; } else if (product.quantity >= 500 && product.quantity <
...   下一页

    摘要: if you have been a java developer for a while you may have had the experience of being told that java cant do everything that native c can. you may have struggled with the hmtleditor pane while win......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE