Transaction Script
Features: A Transaction Script puts all the things it has to do together and does it by itself (there is no message chain, except to call a more underlying database operation ). For example, if you want to book a room, you can check whether there is a vacant room, calculate the rent, and update the database. All the operations are done by yourself and put them in a function. Similar to procedural programming.
Advantages:
1. Simple. High Performance and easy to understand.
2. The processing of one transaction will not affect other transactions.
Disadvantages:
It is difficult to process complicated logic. If you find a lot of repeated code in different Transaction scripts, it means the Transaction Script Mode is insufficient.
Note:
Separate Transaction scripts to at least different functions, and separate them from UI and database operations (different classes and packages ). And because it is located in the middle layer, there should be no method to call the UI.
Transaction Scripts has two methods to organize the class structure.
1. Put several Transaction Scripts in a class, which are logically related.
2. Each Transaction Script corresponds to a class, which can apply the Command mode, but it does not seem necessary.
Involved mode:
The database modes used in Transaction scripts are usually Table Data Gateway and Row Data Gateway.
I am sorry to keep it on the homepage. Thank you for your advice.