Transaction Script (Business Action)

Retired Content

The Web Service Software Factory is now maintained by the community and can be found on the Service Factory site.

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Retired: November 2011

Summary

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

Context/Problem

Most business applications can be thought of as a series of transactions. A transaction may view some information as organized in a particular way, and another transaction 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 other cases, it may involve many steps of validations and calculations.

Solution

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 as shown below.

recognizedRevenue(contractNumber: long, asOf: Date) : Money
calculateRevenueRecognitions(contractNumber long) : void

Acknowledgments

Fowler, Martin. Patterns of Enterprise Application Architecture. Pearson Education, Inc. and Martin Fowler, 2003. Reproduced by permission of Pearson Education, Inc. publishing as Addison Wesley Professional. All rights reserved.