小寒的blog
Programming is a darned hard thing—but I am going to like it.
领域逻辑模式(Domain Logic Patterns
1、Transaction Script(事务脚本)

Organizes business logic by procedures where each procedure handles a single request from the presentation.

For a full description see P of EAA page 110

Most business applications can be thought of as a series of transactions. A transaction may view some information as organized in a particular way, another will make changes to it. Each interaction between a client system and a server system contains a certain amount of logic. In some cases this can be as simple as displaying information in the database. In others it may involve many steps of validations and calculations.

A Transaction Script organizes all this logic primarily as a single procedure, making calls directly to the database or through a thin database wrapper. Each transaction will have its own Transaction Script, although common subtasks can be broken into subprocedures.

    通过过程来组织业务逻辑,其中每一个过程用来处理来自表示层的一个单独的请求!
本模式详细描述参考 PEAA 110页
    多数的商业应用程序可以看作是一系列的事务,一些事务可能是查看一些以特定方式组织的信息,另一些事务可能是用来改变这些信息。一个客户系统和一个服务系统之间的每次交互包含了一定数量的业务逻辑.在某些情况下,这些交互可能是像显示数据库中的信息一样简单。其他情况交互可能包括了多个步骤的验证和计算。事务脚本主要通过单独的过程组织了所有的业务逻辑。包括直接和数据库交互,或者通过简单的数据库包装器。每个事务将拥有自己的事务脚本,尽管公共的子任务可以被分解成子过程!

posted on 2008-01-15 11:39  xhan  阅读(861)  评论(0编辑  收藏  举报