Archive

Tag Archives: Book-Review

Building Microservices – by Sam Newman

5_star

TLDR: If you are looking for an introduction to and overview of the current ‘microservice’ landscape and the concepts and thinking behind it, then look no further. I would recommend this book for architect, developer, QA and operations (DevOps)

Microservices are obviously a very hot topic at the moment, and everyone and their dog appears to have an opinion about this concept. Accordingly, writing a book about microservices and keeping everyone happy is going to be a challenge (and probably impossible).

In my opinion Sam has done a great job here and manages to provide key information on a range of relevant microservice issues, such as the motivations for microservices, how to model services, integration with other systems, deployment, testing, monitoring, security and architecting/implementing microservices at scale.

I’ve seen negative comments towards this book on other sites stating that more code examples should be provided, and although I appreciate their motivations, I don’t believe this will be the book to address these issues. In my experience, code contained within a book can quickly become stale, and the diversity of language (and the associated rate of change) that is currently being used to create microservice implementations would make pleasing everyone an impossible challenge. Instead I recommend people interested in code samples have a Google, or visit InfoQ, DZone or Voxxed where there is plenty of microservice implementation code.

In my opinion I will use this book much like I did the original ‘Continuous Delivery’ book by Jez Humble and Dave Farley – the book will provide an excellent high-level overview of the issues (and potential solutions), help me to understand core concepts and how key components and methodologies relate to each other, and also provide inspiration and pointers to further reading.

Much like I didn’t expect to create a full build pipeline implementation simply from reading the ‘Continuous Delivery’ book, I wouldn’t expect to build a complete microservice ecosystem from Sam’s book. However, after reading both books I began the respective tasks with a lot more insight then I originally had, and I made much smarter decisions (and knew what to look for when searching for more knowledge) once I understood the big picture.

As stated above, I would recommend this book for any software delivery role. I’ve personally seen the benefits of a microservice architecture when deployed for the correct use case, but the nature of this architecture creates new challenges whether you are a developer, QA or operations specialist.

(In the interest of full disclosure I did provide feedback on this book as it was being published via the O’Reilly Early Access program. However, I have endevoured to write a review that takes into account only the final published book.)

Practical Unit Testing with TestNG and Mockito – by Tomek Kaczanowski

5_star

TL;DR This is an essential book on Unit Testing for both novice and experienced Java developer alike. Practical Unit Testing provides a well-paced and logical introduction into the world of Unit Testing, and also offers the more experienced practitioners a discussion on topics such as defining what to test and verify, how to write high-quality and maintainable tests, and also when (shock horror!) not to test. This book provides a plethora of examples and is extremely pragmatic in it’s delivery of testing in the real world. I would also strongly recommend this book to any JUnit fans that haven’t experimented with TestNG lately – you might be surprised what this framework now offers!

Practical Unit testing is divided into five primary sections: ‘Developer’s Tests’, ‘Writing Test’, ‘Hints and Discussion’, ‘Listen and Organise’ and ‘Make them better’. It’s worth mentioning here that this flavour of the book strongly focuses on using TestNG and Mockito (there is a JUnit flavoured version, Practical Unit Testing with JUnit and Mockito). As mentioned above, if you haven’t played with TestNG lately, I would recommend that you do (with this book by you side), as the framework has developed rapidly over the past few years into a genuine competitor against JUnit.

Section 1, ‘Developer’s Tests’, begins by discussing motivations and the core methodology behind testing in general. Unit testing is then defined and the basic concepts introduced to the reader. Section 2 begins by getting the reader to write their first tests, and introduces key concepts such as assertions and parameterised tests.

Section 2 of the book continues with Chapter 4, which introduces the reader to Test Driven Development (TDD), and IMHO this chapter should be read by all Java developers. The author presents an excellent discussion on when to write tests, the ‘rhythm’ of TDD and the benefits offered, and also provides concrete examples. This chapter even covers when not to use TDD, which I know can be heresy to some advocates, but as a long time practitioner of TDD I can relate to points made by the author in this chapter.

As with any technique (or philosophy) as powerful as TDD it is easy to become dogmatic about the subject, and ultimately forgot that not every problem can be solved with a single approach or solution. Paraphrasing the author, he suggests problem areas with applying TDD can include not having a good knowledge of the problem domain, not understanding the technologies, and when working on legacy code. In my experience, I have made several mistakes with applying TDD in the areas identified, and so the author’s cautions should be well received (on a related topic, I can highly recommend Working Effectively with Legacy Code (Robert C. Martin) when dealing with testing legacy code)

Next is very useful discussion Mocks, Stubs and Spies, which is obviously focused on Mockito (which is currently my Mocking framework of choice). As with all the concepts discussed in this book, the example code provided is very useful and of high quality. On a related topic, I would definitely recommend a read of the Mockito website in addition to the this chapter, as the website includes a vast array of examples, and is also updated often.

Section 3 of the book kicks off with Chapter 6, ‘Things You Should Know’, and this chapter is again essential reading. In fact I would go so far to say that this part of the book is worth the entry fee alone – it covers a lot very interesting topics, such as knowing what to test, isolating code under test, making tests timely, using external data and dealing with concurrency. It also discusses what the author refers to as ‘points of controversy’, such as limiting multiple assertions per test (the logical assertions debate) and private method testing.

The remaining two sections of the book focus on getting feedback from tests (and what to do with it), how to organise your tests, and also how to write maintainable high-quality tests. This was an often overlooked topic in a lot of the earlier TDD books, and the often (unspoken) implication was that test code doesn’t have to be as high-quality as ‘production’ code, which is obviously a complete fallacy. In my experience poorly written (and brittle) tests can often slow development down considerably, and this ultimately leads to tests being either removed or ignored…

In summary, this is an essential purchase for any Java developer serious about testing and TDD. For some reason, this book appears to be under the radar to a lot of TDD advocates, and I’m not sure why. The current favourite TDD book, of which I am also a huge fan of, is Effective Unit Testing: A guide for Java developers, and I believe this TestNG-focused book is a great complement to the JUnit-focused work presented in Effective Unit Testing. Practical Unit Testing provides a great introduction for developers new to TDD, and also offers experienced TDDers plenty to think about. The book is well-paced and logical in it’s approach, and provides a comprehensive approach to writing useful, high-quality and maintainable tests.

Click here to buy Practical Unit Testing with TestNG and Mockito on Amazon UK (This is a sponsored link. Please click through and help a fellow developer buy some more books!)

Spring in Practice – by Willie Wheeler and Joshua White

5_star

TLDR; This is an excellent and comprehensive guide to advanced usage of the Spring framework. For anyone who is looking to further their knowledge gained from several years of Spring development in the trenches, this book will pay dividends. Although a Spring novice may be able to learn about Spring from this book, I would recommend picking up a copy of Spring in Action first, as the ‘In practice’ books can be quite fast paced!

As a seasoned Java developer I have been working with the Spring framework for many years now. One of the first Spring books I read was Spring in Action, and in combination with Java Persistence with Hibernate  this book has helped me complete many successful projects (I seriously owe the authors a few beers!). From the grounding provided in these book, and in combination with the excellent Spring Source website, I have been able to explore and develop my skills as the Spring framework has expanded – for example, the Spring Data project is now my go-to framework for all things NoSQL related. However, I always enjoy learning from advanced Spring practitioners and also from reading stories about real-world use and abuse of the framework, and I have yet to find a good book that meets this need – until now. ‘Spring in Practice’ satisfies this gap in the market perfectly.

The book is ~500 pages, and it manages to cram in a lot of content. Advanced usage of all the main Spring components is covered, and covered well. The first nine chapters provide a great grounding and advanced look at topics such as data persistence (ORM), Spring MVC, Web Flow and Security. The remaining chapters deep-dive into topics such as Integration Testing and Enterprise Integration (REST, RabbitMQ and IMAP integration etc), and really focus on how to write good (high-quality) code for the common but difficult tasks.

As the title suggests, the book’s focus is very much about practical usage of Spring. It’s not quite in the ‘cookbook’ style you may have seen with other books, but IMHO, this book is better organised for general learning (i.e. reading the book from cover to cover). The obvious advantage with a cookbook style reference is that it’s easy to cherry-pick solutions to problems, but I find that cookbooks can be difficult to read through if you simply want to learn. ‘Spring in Practice’ is logically structured, the book is nicely paced for the advanced developer, and the discussions of real-world problems and the related code sample solutions seek to further your knowledge and encourage exploration of Spring.

As mentioned above, I have worked with Spring for several years, but this book has taught me lot of new tricks – there’s nothing like finding a section of the book that leads to a ‘no way, Spring does that?’ moment 🙂 The author’s clearly have their own style of developing in Spring, and I personally would chose to do some things differently (e.g. I code the production of XML/JSON differently), but I can’t argue that what they’ve done isn’t best practice, and with a framework as large and wide-scoped as Spring, there is bound to be many approaches to do the same thing.

In summary, this is an excellent book, and one that should be on the bookshelf of any serious Spring developer. It will help deepen knowledge gained from ‘Spring in Action’, and also help to augment skills honed from time in the development trenches. I can almost guarantee that anyone who picks up a copy of this book, no matter how advanced they are, will learn something new. As you’ve no doubt guessed by now, I highly recommend this book, and I would like to offer my congratulations to the authors and Manning for writing a book which has long been needed by advanced Spring practitioners!

Click Here to buy ‘Java Persistence with Hibernate‘ on Amazon (This is a sponsored link. Please click through and help a fellow developer to buy some more books!  )

Scala In Action – by Nilanjan Raychaudhuri

5_star

TL;DR This is a great book if you are looking for a rapid introduction to Scala (and its idiomatic usage) with a very practical focus. Where else would you be building a Scala-based RESTful API and MongoDB driver within the first few chapters, and more importantly be having fun doing it!

‘Scala in Action’ states that the target audience is open to all levels, but I believe that programmers with some previous exposure to an OO language (especially Java) will get the most benefit. This is not to say novice developers won’t enjoy the book, but they may find it moving at quite a fast pace.

‘Scala in Action’ will offer seasoned developers much to think about, as this book is very focused in teaching you pragmatic (and idiomatic) usage of Scala. The fact that the Scala language manages to blend both Object Oriented and Functional paradigms means that learning this language will provide a great transition into the differing approaches offered by these styles. (Could Scala be considered a ‘gateway’ language? 🙂 ). This makes Scala a great choice for your next language, and the fact that the book encourages idiomatic usage of the language is a great help in fully understanding the power and appropriate application of the language.

In addition to the topics mentioned above, this book also covers concurrency using the Actor model with Akka (to which I am becoming more and more of an enthusiast!), testing and TDD (which I believe is a mandatory topic in any new programming book) and the interoperability between Java and Scala.

I haven’t fully digested all of the book yet, and even when I have I’m confident that I will be reading the content several more times (and more imporantly, experimenting even more with the code samples).

In summary, ‘Scala in Action’ has been a perfect companion in my first serious voyage into learning this language, and it comes highly recommended for anyone else attempting the same task!

Click Here to buy Scala in Action on Amazon (This is a sponsored link. Please click through and help a fellow developer to buy some more books! 🙂 )