Sunday, May 5, 2013

Service Design Patterns: Fundamental Design Solutions for SOAP/WSDL and RESTful Web Services 1st edition, Robert Daigneau



I have been a fan of the Martin Fowler Signature Series for a long time. This book fit into the series great and filled in a missing link in the series.

One of the things I liked seeing was that the author does not think web services are a silver bullet. Right off the bat he warns that web services should be reserved for situations which out-of-process and cross-machine calls "make sense".

The book is broken down into seven chapters, an appendix, and a nice glossary. The chapters include From Objects to Web Services, Web Service API Styles, Client-Service Interactions, Request and Response Management, Web Service Implementation Styles, Web Service Infrastructures, Web Service Evolution, and an appendix Reference to External Patterns.

I felt the book worked at the right level of abstraction digging into details when needed to shed a deeper light on the subject at hand.

Each chapter contains several related patterns. Each pattern answers a primary question. For example chapter one Web Service API Styles cover the following 3 patterns that answer the question that follows below.

RPC API - How can clients execute remote procedures over HTTP?

Message API - How can clients send commands, notifications, or other information to remote systems over HTTP while avoiding direct coupling to remote procedures?

Resource API - How can a client manipulate data managed by a remote system, avoid direct coupling to remote procedures, and minimize the need for domain-specific APIs?

The other patterns covered in the book include Request/Response, Request/Acknowledge, Media Type Negotiation, Linked Service, Service Controller, Data Transfer Object, Request Mapper, Response Mapper, Transaction Script, Datasource Adapter, Operation Script, Command Invoker, Workflow Connector, Service Connector, Service Descriptor, Asynchronous Response Handler, Service Interceptor, Idempotent Retry, SOA Infrastructures, Breaking Changes, Versioning, Single Message Argument, Dataset Amendment, Tolerant Reader, and Consumer-Driven Contract.

Like the other pattern catalogs the book contains an online catalog of the patterns in the book. Although the online catalog gives you an overview of each pattern, the book contains a lot more detail about each one. I like the online catalogs. I often visit them to spark my memory about the patterns that I have read about in the books.

I like that the book limited its scope to the fundamental patterns relevant to web service design. It does not try to be all encompassing, which I think made it better than if the author had tried to be. The book does not cover enterprise integration patterns, workflow or orchestration, security, event-driven architecture, or choreography. The book does include a nice reference to external patterns in the appendix that provides a summary and where to go for more information.

I think each pattern is explained really well and the examples used do a great job of showing a possible implementation. I liked the end of chapter 7 where the author provides a nice summary about how each pattern hinders or promotes evolution.

The book also includes a nice glossary that provides quick reference to additional information on topics mentioned in the book.

The author does an awesome job of providing examples in different technologies throughout the book. The author uses a nice mixture of .NET and Java technologies. Some of the technologies used are JAX-WS, JAX-RS, JAXB, JSON, XML, Xpath, XSLT, WSDL, DataContractSerializer, XmlSerializer, and WCF. To top it off the author's writing style makes the reading really easy.

All in all I think every architect and developer should have this book on their shelf.

SUMMARY: This book might have presented some interesting topics and patterns for discussion and debate, but it is far from an authoritative patterns book. It lacks "The Narratives" in PoEAA, while the patterns in it lack the usefulness of those found in EIP.

When I saw this book on the Amazon, I purchased the printed book straight away without having had a quick read of the book, say from a pdf you can download on the Internet, since I really enjoyed reading the other two pattern books in the Martin Fowler series, i.e., Patterns of Enterprise Application Architecture (PoEAA) and Enterprise Integration Patterns (EIP).

It turns out to be a disappointment with this book.

Why? First, with the other two patterns books, in some cases I learned/relearned some core concepts of Enterprise Application or Enterprise Integration, while in other cases I learned some best way to describe what I had already learned from experience. Unfortunately, I don't feel I "get" the core concepts from this book about SOAP based Web service or REST Web service, except "situations in which out-of-process and cross-machine calls 'make sense'" (page 8).

Second, the patterns in the book generally try to prescribe what industry has been actually doing (often using a different vocabulary). The problem starts when you try to have a more clear understanding of the patterns by reading the examples for the patterns and by trying to make a connection between the patterns and actual SOAP or REST implementation technologies.

Take chapter 2 Web Service API patterns as an example. After reading the three patterns (RPC API, Message API and Resource API), you would think the SOAP document/literal wrapped style or SOAP RPC style are typical implementation of the RPC API pattern, SOAP document/literal bare (unwrapped) or POX as typical implementation of the Message API pattern.

No, not according to the explanation the author gives for the examples.

This is how the author explains the difference between RPC API and Message API (page 31), "Notice that each operation receive a single message argument. This is one very subtle characteristic that differentiates RPC APIs from Message APIs. While the former ..., Message APIs that leverage WSDL are specifically designed to receive a single message argument". But when you turn to page 234, there is actually a Single Message Argument patten for RPC API. What does the author really try to say? Convert RPC APIs to Message APIs by using the Single Message Argument pattern? :-)

Another peculiar in the book is to associate "Service Interface Classes" exclusively with generated service interface code in the contract-first approach (page 179) and describe the code-first approach as "In the Code-First practice, developers create annotated Service Controllers in languages like Java and C#" (page 180). While in reality, for RPC API and Message API, the widely used and more sound practice with code-first is to create annotated "Service Interface Classes" in Java or C# first and then write Service Controller that implements the interface.

This book might have presented some interesting topics and patterns for discussion and debate, but it is far from an authoritative patterns book. It lacks "The Narratives" in PoEAA, while the patterns in it lack the usefulness of those found in EIP.

I found Service Design Patterns to be a refreshing and well-crafted book. I would expect nothing less from anything accepted into the Fowler series. The author is quite clear from the very beginning that this book is intended to get the reader familiar with the most common approaches for implementing services. At first inspection of this statement, I expected to read lots of problem statements, with pattern definitions, and code samples to follow that mapped directly to SOAP/WSDL and REST. I was pleasantly surprised.

In the pages of the very first chapter this book challenges your standard thought on Service Architecture. Over the years I have asked many colleagues why they think SOA is a superior architecture. Often I have received the response that it reduces complexity, provides loose coupling, and is the most reliable way to allow disparate systems to communicate. Naturally, the next question is, well how are those objectives met? That question tends to put a wrinkle on the face of some of the most seasoned software architects. This book presents those questions, and paints candid responses before you get to page 10.

As you advance through the chapters, the author did a great job at codifying various approaches to web service design in a way that's not specific to any particular technology or specification. The pattern descriptions are easy to read, help the reader understand how to choose between them and the contexts in which to use them. The book provides an easy to reference handbook that classifies the patterns into categories that really make sense, and I think it gives practitioners a very useful vocabulary. Although the title says it's about creating services for SOAP/WSDL and REST, it's not a book about either. I am glad the author took this approach as there is plenty of material on both of these subjects. It might have been helpful for the author to address this up front.

Long story short, this book does a nice job of bridging the gap between Patterns of Enterprise Application and Enterprise Application Architecture. A nice reference book.

Product Details :
Hardcover: 352 pages
Publisher: Addison-Wesley Professional; 1 edition (November 4, 2011)
Language: English
ISBN-10: 032154420X
ISBN-13: 978-0321544209
Product Dimensions: 7.1 x 0.9 x 9.2 inches

More Details about Service Design Patterns: Fundamental Design Solutions for SOAP/WSDL and RESTful Web Services 1st edition

or

Download Service Design Patterns: Fundamental Design Solutions for SOAP/WSDL and RESTful Web Services 1st edition PDF Ebook

No comments:

Post a Comment