|Service-Oriented Design with Ruby and Rails
Author: Paul Dix
This is all about building services in Ruby with an emphasis on Rails (versions 2 and 3). By service the book almost exclusively means Rest-based design.
It starts off at quite a pace with a quick introduction to the Ruby toolset you need - Sinatra, ActiveRecord, JSON, Typhoneus and Rspec. The first example is very difficult to follow even if you are an experienced Ruby programmer. It introduces the use of the tool set very quickly and without much explanation. Indeed it even says things like,
"The details of each are unimportant as you continue with the user specs."
which in itself is a fairly mysterious sentence. You then have a long list of tiny actions that the service is to perform and the overall effect is that it is boring as a first overview tour of what is to come next. A simpler introduction perhaps with some explanation of what is going on might ease the beginner into the material better than the current chapter 1.
Chapter 2 is probably a better starting point for the entire book. We first have an overview of service oriented design - including Rest and Soap although the full details of Rest are held over to an appendix. At the end of the chapter you have a fairly standard introduction to the use of services from a slightly Ruby/Rails point of view - and yes Rails architecture benefits from decomposition into services.
Chapter 3 moves on to a case study - as social feed reader. Here you first begin to notice that all the way through the book the diagrams are far too big and take up too much space. OK - not a serious fault but puzzling. The example itself takes a standard Rails application and segments into services - in theory not actually in practice. Chapter 4 moves on to consider the task of implementing the service as an exposed API. This is another fairly abstract account of the considerations involved in building a Rest based system - again you need to know what Rest is all about first.
Chapter 5 is about implementation but first it goes into details of API design again. Eventually it covers practical matters such as how to organize and implement routes in Rails 2.3 and 3 - but it doesn't really explain what is going on at all. Mostly it states there is something you can use and then presents a long listing which is supposed to be self explanatory - and there aren't even many comments.
From here we look at connecting to service - mostly how to use Typhoeus, the authors own library for performing asynchronous operations. We next look at developing service client libraries - how to write a gem, parsing JSON and other aspects of how to present your API to the client. Chapter 8 is on load balancing and caching a devops sort of topic. Chapter 9 focuses on parsing XML in Ruby just in case you need to work with an old service or actually think XML is better than JSON. This is also were we briefly meet SOAP - something to be avoided if possible. Chapter 10 covers security, Chapter 11 messaging, and the final chapter describes web hooks and external services.
To get anything out of this book at all you need to be a good Ruby programmer and very comfortable with Rails - as the book doesn't provide an introduction to either. It is mainly an account of the accepted ideas of implementing a Restful API with some discussion of how a Rails system could be organized as a service architecture.
The big problem with the book is that it is light on explanation. It tends to simply mention the library that is needed to do the job, say a few things about it, show sometimes long example and then move on. No introduction to the library and usually no overview. A beginner would even be hard pressed to actually implement any of the examples and get them working. It seems stronger on the high level view of the architecture than it does on the basic details.
If you are a Ruby/Rails expert and want to read some high level service architecture backed up with mostly unexplained examples of how to use some libraries, then you might find it useful. If you are a beginner to intermediate programmer then look for another book.
|Last Updated ( Monday, 08 May 2017 )