About the author

I came across this book by Mark Richards- Java Transaction Design Strategies. For those who are not from Boston area- mark is a much familiar face in the NEJUG meetings- ever second Thursday. He served as the President for quite some time.

The book:

The book is about Transactions- in java applications- using EJB or Spring

Mark has done a good job of drawing a distinction between Transaction Models vs Transaction Strategies. Transaction Model is how you declare your transactions. Transaction strategy on the other hand is putting together a strategy on where to put transactions and who is responsible for what.

Throughout the book- he draw examples and contrasts Spring and EJB.

Code examples are minimal- its more of easy to read and grasp language. I personally do not like books with lots of code- so this went well with me. This book has been deliberately written in a concise manner – which it makes it easy to read and finish

The book is divided in two parts. The first part introduces the three Transaction Models- Local Transaction Model, Programmatic Model, Declarative Model. It also provides a recap of common transaction related terms- JTA ,JTS, ACID, Isolation levels,XA transactions, Two phase commit,Heuristic Transactions, LPS

Second Part discusses three design patterns- Client Owner Transaction Design pattern, Domain Service Owner Transaction Design Pattern,Server Delegate Owner Transaction Design Pattern.

Best Practices suggested in this book:

In declarative transactions: Make the class level transaction- most restrictive , and then fine tune for individual methods as needed

The method that starts the transaction- should be the one to commit or rollback

If a method requires a transaction context – but is not responsible for  marking it as rollback- then it should have an attribute of  Mandatory

Use XA only of you have multiple resources participating – in tech same transaction context

I enjoyed reading the book and would recommend to anyone- seeking a quick and clean introduction to Transactions with a touch of Java and Spring

You can get the book from here
.

 

Following is a collection of some principles\suggestions\rules\guidelines- whatever you wish to call them- to be kept in mind while designing software.

Some of this was inspired by Head-First Design patterns book- which I concluded recently. An excellent read- BTW.

I would recommend every earnest programmer to keep these principles posted at a visible location in his/her work place.

A) The Single Responsibility Principle – A class should have only one reason to change.
B) Open Closed Principle – Classes should be open for design but closed for modification .
C) Liskov substitution principle
D) Interface Segregation Principle – The dependency of one class to another one should depend on the smallest possible interface.
E) Dependency Inversion Principle – High level modules should not depend upon low level modules. Both should depend upon abstractions.
F) Encapsulate what varies
G) Favor composition over inheritance
H) Program to interface ,not implementations
I) Strive for loosely coupled designs between objects that interact
J) Depend upon abstraction, do not depend upon concrete classes
K) Principle of least knowledge – Only talk to your friends
L) Inversion of control- Don’t call us, we’ll call you.
M) Tell, Don’t Ask

© 2011 Technology Cafe Suffusion theme by Sayontan Sinha