Friday, November 28, 2014

Book Review: RESTful Java Patterns and Best Practices

I had the privilege to review the book RESTful Java Patterns and Best Practices, authored by Bhakti Mehta for Packt Publishing.  In short, this book hits the sweet spot when it comes to learning utilization of RESTful web services.  As the book provides a solid foundation for the creation, testing, and utilization of RESTful web services with JAX-RS 2.0, it also provides information on essential topics, such as authentication, security, and performance.  There is even coverage of advanced topics, such as rate-limiting, polling, and micro services.  




The book begins by providing a general understanding RESTful web services, design principals, and the differences between the various HTTP verbs.  This discussion is provided at a high level, such that it is generalized enough to cover various RESTful web service implementations.  The first chapter then goes into the Java API for RESTful Web Services.  This section of the first chapter is brief, and to the point.  It clearly explains how to create services and then test/access them via the Client API, cURL, and other utilities.  As mentioned at the top of this post, Chapter 1 provides a solid foundation...and it is a quick read also, which enables developers to get up and running quickly with the JAX-RS API.

Chapter 2 covers fundamentals, such as returning various content types (JSON, XML, etc.), and designing meaningful URL patterns to obtain the desired media type.  This chapter delves into streaming and chunked content, parsing JSON, and versioning support.  Chapter 2 builds upon Chapter 1 very nicely, further explaining the fundamental concepts of RESTful services.

The third chapter covers security, validation, and logging of RESTful web services.  This is a chapter for intermediate users, as it goes beyond the basics and covers the use of filters for logging, and constraint annotations for validation.  It then provides a brief example of building an exception class.  Lastly, this chapter goes into authentication practices using SAML (Security Assertion Markup Language), OAuth, and tokens.  While this chapter sets a good stage for discussing the various types of authentication, it does not go into detail on these topics.

Chapter 4 covers performance via caching, asynchronous and long-running jobs, and partial updates.  The chapter clearly explains how to utilize the Cache-Control header and ETags.  It then explains how to design asynchronous web services, and some best practices.  The last topic in the chapter is partial updates...a topic that is briefly explained, but leaves room for further exploration.

The next chapter goes into advanced topics for RESTful web services...including rate-limiting, response pagination, internationalization and localization, and pluggability and extensibility.  I really liked the way that this chapter covered rate-limiting in detail, and explained why this is an important topic.  It then provides a detailed explanation for response pagination, along with a good example.  The internationalization and localization section is brief, but provides a good enough explanation for getting started with internationalization.  Lastly, the chapter provides a brief overview HATEOAS (Hypermedia as the Engine of Application State), testing, and extensibility.

The final chapter does a good job of wrapping up the many topics of RESTful web services, discussing the future of REST and emerging standards.  It is a chapter that explains polling and the importance of providing real-time APIs for avoiding inefficiencies.  Along the way, it touches upon various topics, such as WebHooks, SSEs (Server Sent Events), and WebSockets, and how they relate to RESTful services.

The book contains a helpful Appendix which covers various APIs from GitHub, Facebook, and Twitter.  It is a nice closeout to the book, providing an overview of how to glean information from these important social media networks.

Overall, this book is a great read for getting started with RESTful web service creation and utilization with JAX-RS.  I enjoyed the fact that the book was authored by Bhakti, who is very experienced with the topic, as she is a founding member of the GlassFish Application Server.  I recommend this read for anyone who wants to get up and running quickly with REST, and also learn about various other RESTful concepts along the way.  While this book does not delve into fine-grained details of topics such as authentication and partial updates, it provides a good foundation for learning more on such topics.  Readers will go away from this book with a solid understanding of how to develop RESTful web services, and they will be able to start developing services after reading through the book.  Those who wish to delve into more advanced topics will be provided with a good overview after reading this book, and they'll be pointed into the right direction for learning more on such topics.

No comments:

Post a Comment

Please leave a comment...