- Revolving Door: MPAA Hires Chief USTR Negotiator Behind ACTA And TPP’s IP Chapter
- Copyright Maximalists’ Incredible Sense Of Entitlement: If It Challenges The Biz Model We Chose, It Must Be Illegal
- Turkey’s Prime Minister Sues His Own Country Over Twitter
- Picturefill 2
- Police File On Student ‘Bullied Into Committing Suicide’ Strangely Lacking In Evidence Of Bullying
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- August 2013
- July 2013
- June 2013
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- December 2008
- November 2008
- October 2008
Category Archives: Book Review
Web Hosting Related Articles You May Need
Video Review: jQuery UI Development
This post is my review of jQuery UI Development, a Packt Publishing video course by Ben Fhala that is intended to help viewers “utilize jQuery UI to its full potential.” The jQuery UI page describes jQuery UI as “a curated set of user interface interac… Continue reading
Video Review: JBoss EAP Configuration, Deployment, and Administration
Packt Publishing released the video JBoss EAP Configuration, Deployment, and Administration by Red Hat employee Jason Shepherd in October 2013. This post is my review of this training video on configuring, deploying, and administrating the JBoss Enterp… Continue reading
Posted in Book Review, Java EE 6, JBoss, Syndicated Comments Off on Video Review: JBoss EAP Configuration, Deployment, and Administration
Video Review: HTML5 Game Development
Packt Publishing recently invited me to review the recently released video HTML5 Game Development by Makzan (http://makzan.net/). I hesitated initially to accept this offer because I’ve typically preferred reading text (books, blogs, and articles) over watching videos and podcasts for learning new technical concepts. However, after viewing the HTML5 Game Development video, I’m glad that I accepted that offer.
The HTML5 Game Development video, once downloaded, can be viewed in a web browser via the Packt Video player. The next screen snapshot demonstrates this for the first section of the video.
The HTML5 Game Development video is a series of short video clips ranging from a little shorter than 2 minutes to a little longer than 4 minutes each. These videos are categorized by “section” (sections are referenced as “chapters” in navigation buttons) and the next screen snapshot shows the first, second, and last (eighth) sections. The one in the middle (Section 1 in this case) is the Section whose video snippets would be viewed when the “Browse Videos” button is clicked.
When a Section (or Chapter) is selected, multiple short videos are made available. An example of this is shown in the next screen snapshot. Click on “Watch Video” allows one to start watching the specific video.
I have taken the time in this post to depict this presentation of the short video snippets because there are some advantages to the HTML5 Game Development video being available in this format. The short videos allow easily digestible amounts of information to be seen in just a few minutes. Objectives for each video snippet are outlined before the video snippet and then are addressed in the video snippet. With such short video snippets available and with clear objectives outlined before each video, it is easy to pick and choose which portions to watch more than once. An effective way of viewing this overall video might be to first watch the video snippets once through and then return to those of most interest are those that need to be seen again.
The overall video length is advertised as just under 2 hours. This is divided into eight chapters/sections ranging from 12+ minutes each to 17+ minutes each. With each chapter/section having 5 videos, these videos range from 1 minute to 4 minutes each. The Packt HTML5 Game Development Video Table of Contents outlines the eight chapters/sections, the five videos per chapter/section, and the total duration of each chapter/section. The O’Reilly page for this video breaks down each of the five videos in each of the eight chapters/sections by their individual durations (to minutes granularity).
HTML5 Game Development depicts application of several interesting products. Its use of Sublime Text makes it easy to read the code thanks to color coded syntax on a dark background, line numbers, code completion, and keyword matching capabilities. The video also uses Sloppy and the iOS Simulator to help demonstrate adjusting the developed games to run on mobile devices. The video also demonstrates using free tools available online to secure fonts and make them presentable on the web. Another example is the video’s demonstration of using Zoë to covert Flash animation to sprite sheets (.png and .json files) and then applying those with EaselJS Sprite Sheet Animations.
The videos demonstrate quite a bit in the two hours. The narration is quick and the code editing in Sublime Text is quick thanks to significant copying-and-pasting that occurs in synchronization with the narration. I enjoyed the relatively fast pace because I didn’t have a chance to lose interest or get bored. However, I was glad that I had used HTML5 technologies previously because a lot of content was covered so rapidly. For viewers with less experience with these technologies, the short videos provide the opportunity to easily re-watch parts that need more than one viewing and possibly mix viewing of those parts with reading other more introductory resources.
There are a few things to note to get the most out of “HTML5 Game Development.” Although video 6.2 is called “Applying Gravity to the Hero”, it actually talks about running hero and moving camera instead of falling hero. On the other hand, video 6.3 is called “Making the Hero Run” but talks about making the hero stop falling on the platform rather than falling through it. These videos, at least in my download, were switched in order.
To see full screen (which is particularly important with the code editing video), click on the square to the right of the video progress bar and volume control when mouse cursor is over video in the Packt Video Player.
The audio in HTML5 Game Development is clear and the woman narrating the video speaks in a clear manner and enunciates well (and I liked the accent).
Posted in Book Review, HTML5, Syndicated Comments Off on Video Review: HTML5 Game Development
Book Review: Backbone.js Patterns and Best Practices
The sub-title of Swarnendu De‘s Backbone.js Patterns and Best Practices (Packt Publishing, 2014) is “A one-stop guide to best practices and design patterns when building applications using Backbone.js.” The Backbone.js site describes Backbone.js as follows:
Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
The Preface further reinforces the point that this book is not for beginners when talking about the book’s objective: “Whether you are an intermediate- or advanced-level Backbone.js developer, this book will guide you through the best practices and patterns to handle different issues with each Backbone component.”
Chapter 1: Reducing Boilerplate with Plugin Development
The initial chapter of Backbone.js Patterns and Best Practices introduces the basics of Backbone.js and provides short descriptions of Backbone.Model, Backbone.View, Backbone.Collection, Backbone.Router, and Backbone.Events. The first chapter introduces the Underscore.js utility and mentions that “Backbone.js has a hard dependency on Underscore.js.” The author also mentions Lo-Dash as an Underscore.js alternative. The core coverage of this initial chapter is on reusing code by extending (with and without a base class) and using mixins.
Chapter 2: Working with Views
The second chapter also introduces Marionette.js, which it describes as “a composite application library for Backbone.js.” The focus is on Marionette’s ItemView, CollectionView, and CompositeView.
Chapter 2 moves finishes with coverage of backbone.layoutmanager as an alternative to Marionette RegionManager.
Chapter 3: Working with Models
Backbone.js Patterns and Best Practices‘s third chapter discusses working with Backbone models. The chapter begins by outlining the basics of Backbone models and how to use Backbone models with an emphasis on CRUD (create/read/update/delete) operations. Model validation is covered next with examples of using direct Backbone model validation as well as using Backbone.Validation. Chapter 2 covers serialization of Backbone models and using Backbone-relational.js for relational data work with Backbone.
Chapter 4: Working with Collections
Chapter 4 of Backbone.js Patterns and Best Practices defines a Backbone collection as “an ordered set of models” that includes “functionality to add, remove, sort, and filter models, and save to or fetch data from the server.” The chapter includes a brief overview of Backbone collections before moving onto describing how to perform database-related operations on a Backbone collection. Sorting and filtering of Backbone collections are also covered in the fourth chapter.
Chapter 5: Routing Best Practices and Subrouting
The fifth chapter in Backbone.js Patterns and Best Practices describes a Backbone router as a mechanism that matches a “URL fragment” to an invoked method. The chapter provides an overview of Backbone routers and routing before moving onto coverage of “best practices for working with routers.” In the course of this discussion, the author references Marionette.AppRouter and Marionette.Controller. Sub-routing is described in Chapter 5 and the extension backbone.subroute is specifically referenced.
Chapter 6: Working with Events, Sync, and Storage
Chapter 6 of Backbone.js Patterns and Best Practies covers “custom events, Backbone.sync() method and Backbone.LocalStorage.” The portion of the chapter on events begins with a definition of events from the Backbone.Events API page. This section demonstrates how easy it is to create custom events in Backbone, contrasts use of Events to use of Callbacks, and provides a case study describing use of events. The section of Chapter 6 on Backbone.LocalStorage discusses and demonstrates use of Backbone.localStorage Adapter before mention an alternative called Backbone.dualStorage.
Chapter 7: Organizing Backbone Applications – Structure, Optimize, and Deploy
As its title suggests, Chapter 7 of Backbone.js Patterns and Best Practices discusses issues related to application structure, optimization, and deployment of Backbone-based applications. The author proposes an application directory structure which “is not something that will work universally for every application,” but “lots of developers use it for their projects without any issues.”
One of Chapter 7’s main themes is Asynchronous Model Definition and using Require.js to add AMD support to a Backbone application.
Chapter 8: Unit Test, Stub, Spy, and Mock Your App
Appendix A: Books, Tutorials, and References
Appendix A includes the author’s recommendations for three books on Backbone.js along with recommended online tutorials and blog posts on Backbone.js. This appendix also includes references to additional resources on testing Backbone-based applications with QUnit and SinonJS as well as references to more Backbone plugins and tutorials.
Appendix B: Precompiling Templates on the Server Side
Appendix C: Organizing Templates with AMD and Require.js
Although two chapters earlier in Backbone.js Patterns and Best Practices discuss AMD and Require.js briefly, both chapters reference Appendix C for additional details. The example in this appendix is built on top of requirejs-tpl.
- My most important observation is that the implication of Backbone.js Patterns and Best Practices‘s title and the explicit statements in its Preface that the book is targeted at intermediate Backbone developers should not be taken lightly. Although the book does provide some brief introductory material on most of the subjects it covers, at least some familiarity with the basics of a Backbone.js-based application would be extremely beneficial in realizing the full value of reading this book.
- There are not many images or screen snapshots in this book, but these are not particularly important to the content.
- Even in the PDF version of Backbone.js Patterns and Best Practices that I reviewed, the code listings are black text on white background with no color syntax. Most of the code listings are short enough to mitigate the issue, but color-coded syntax would be easier to read.
- Backbone.js Patterns and Best Practices is written with the intent to discuss issues that the author believes developers frequently run into when developing Backbone-based applications.
Conclusion and Recommendation
Book Review: Test-Driven Development with Mockito
Test-Driven Development with Mockito provides a general introduction to test-driven development (TDD) before looking at application of Mockito to implement test doubles as part of test-driven development. Test-Driven Development with Mockito is written by Sujoy Acharya, is published by Packt Publishing with a publication date of November 2013, and has about 150 substantive pages of substantive content divided into 9 chapters and 2 appendices. The subtitle of Test-Driven Development with Mockito is “Learn how to apply Test-Driven Development and the Mockito framework in real life projects, using realistic, hands-on examples.”
Test-Driven Development with Mockito‘s Preface opens with a very brief description of test-driven development and how Mockito plays a role in test-driven development. The preface summarizes each chapter and appendix before recommending what a reader of that book should use while reading the book: J2SE 5, the Eclipse IDE (Kepler 4.3 recommended), and Mockito.
One of the most important parts of a Packt Publishing Preface is the section on “Who this book is for.” In this case, the paragraph in this section states:
This book is for developers who want to develop software according to Test Driven Development using Mockito and to leverage various Mockito features. Developers don’t need prior knowledge of TDD, Mockito, or JUnit. It is ideal for developers who have some experience in Java application development as well as some basic knowledge of unit testing, but it covers the basic fundamentals of TDD and JUnit testing to get you acquainted with these concepts before you use them.
Chapter 1: Getting Familiar with TDD
As the Preface stated, Test-Driven Development with Mockito does cover “basic fundamentals of TDD” and begins this in the first chapter. This chapter starts out at a very basic level, defining a test in Java development and listing some “available code-driven unit-testing frameworks for Java.” In this chapter, we learn that JUnit 4.0 will be used in examples in the book. An example is then presented using Eclipse and JUnit in which the test class is written before the production class. This transitions into more details on the historical background of TDD and lists benefits of TDD.
Chapter 1 continues by looking into how TDD fits into overall software development and how refactoring plays a role in test-driven development. In many ways this first chapter is what you’d expect from a book on test-driven development. The code-based examples of test-driven development do a nice job of illustrating basic techniques and advantages associated with test-driven development. However, there seemed to be some things that seemed a bit out of place in this chapter. In particular, the chapter’s extremely brief coverage of “Object-function programming languages such as Scala and Groovy” seemed irrelevant to the rest of the chapter and added little value. As with most books on TDD, this chapter of this book had a paragraph that seemed a bit preachy.
Chapter 2: Refactoring – Roll the Dice
The second chapter of Test-Driven Development with Mockito, as its name implies, focuses on refactoring. The chapter begins by reviewing benefits of refactoring and then discusses “trigger points for refactoring” and when not to refactor. Some relatively lengthy code listings are provided to show some code in desperate need of refactoring with text explaining issues with the code and possible ways to refactor that code. This section of the book also introduces the Eclipse plugin CodePro Analytix.
The second chapter moves onto coverage of code smells. Duplicate code with
switch statements is shown as a code smell and there is discussion and more code listings on how to refactor this using the strategy pattern and polymorphic behavior. Other code smells that are covered in this chapter along with potential remedies include duplicate code, comments, long methods, long method parameter lists, large classes, dead code, and overengineering.
This second chapter is a reasonable introduction to code smells and how to use refactoring and other techniques to deal with them. This chapter mentions common object-oriented and software development principles such as YAGNI, DRY, open-closed principle, and strategy pattern. A single chapter of a book cannot compete with an entire seminal treatment of a subject, but this chapter does provide a good illustration of how refactoring fits into TDD.
Chapter 3: Applying TDD
The third chapter of Test-Driven Development with Mockito begins with a bold statement, “Test-Driven Development (TDD) is the new way of programming.” The chapter then outlines the simple steps that are taken to implement TDD and is the first chapter in the book to really dive into TDD. The chapter concludes with a lengthy example including code listings and Eclipse screen snapshots to demonstrate JUnit and TDD in practice.
Chapter 4: Understanding the Difference between Inside-out and Outside-in
Chapter 4 of Test-Driven Development with Mockito compares and contrasts TDD’s two “common” styles: Outside-In and Inside-Out. The chapter provides details regarding the outside-in approach before listing advantages and disadvantages of that outside-in approach. The same is then done for inside-out, though the coverage is much shorter than for outside-in.
Chapter 5: Test Doubles
Test-Driven Development with Mockito‘s fifth chapter covers test doubles. The chapter very briefly discusses why test doubles are useful (I don’t think this part is particularly strong) before categorizing the types of test doubles (dummy, stub, mock, and fake). The coverage of these types of test doubles is much better than the general introduction to test doubles and provides nice code examples and discussion on each and how they are different.
Chapter 6: Mockito Magic
Chapter 6 of Test-Driven Development with Mockito is the book’s first significant look at Mockito (although Mockito was mentioned in Chapter 5 for the example of the mock category of test double). The chapter begins with an overview of Mockito and explains Mockito’s primary roles in test-driven development: “Mockito plays a key role to mock out external dependencies” and helps achieve the desired “qualities of unit testing.”
Chapter 6 continues by demonstrating adding Mockito to Eclipse. There are numerous screen snapshots of Mockito being used within Eclipse (these are in color in the electronic edition of the book). The chapter introduces key annotations and functionality provided by Mockito and demonstrates using Mockito to address things commonly tested using mocks. A reader of this book who’s primary interest in the book is learning Mockito would find this to be one of his or her favorite chapters of the book.
Chapter 7: Leveraging the Mockito Framework in TDD
Test-Driven Development with Mockito‘s seventh chapter begins with a brief discussion of classical TDD versus mockist TDD. The chapter is then introduced with the statement that it will “use Mockist TDD style to mock external dependencies and explore Test-Driven Development.” The entire chapter is then devoted to a fairly realistic example of building an “online portal for the aspiring game developers” with test-driven development techniques and using Mockito to mock out the external interfaces.
Chapter 8: World of Patterns
Chapter 8 of Test-Driven Development with Mockito opens with reference to Robert Martin‘s “three important characteristics of a bad design“: rigidity, fragility, and immobility. The chapter then covers “higher level design guidelines” of modularity, high cohesion, and low coupling and “lower level design principles” of Open/Closed Principle, Dependency Inversion Principle, Integration Segregation Principle, Single Responsibility Principle, Liskov Substitution Principle, and the Law of Demeter.
The next section of Chapter 8 discusses design patterns. The section provides an overview of what design patterns are, how they are categorized, and provides a couple of examples of applying design patterns.
Chapter 9: TDD, Legacy Code, and Mockito
The ninth chapter of Test-Driven Development with Mockito discusses what constitutes legacy code and then emphasizes: “Any code with no unit test is legacy code.” Chapter 9 looks at some common less-than-testable features of legacy code and how to refactor that code for greater testability. The chapter then moves onto how Mockito can make it easier to refactor code to be more testable.
Appendix A: TDD Tools and Frameworks
Appendix A covers Eclipse IDE and JUnit 4 unit testing framework. It discusses using keyboard shortcuts in Eclipse (including “The mother of all shortcuts is Ctrl + Shift + L” to see all shortcuts) and emphasizes those shortcuts useful in refactoring and TDD. There are some nice color screen snapshots showing shortcuts applied in this section. Appendix A’s coverage of JUnit begins with the statement, “Inheritance in Java is not a smart thing to implement” to explain advantages of JUnit 4.x (which supports annotations) over earlier versions which required inheritance. Appendix A’s coverage of JUnit covers fundamentals of JUnit and demonstrates using Eclipse shortcuts in JUnit unit test development.
Appendix B: Agile Practices
Appendix B discusses continuous integration (CI) in general before covering Jenkins as a particular continuous integration tool. The author begins continuous integration coverage with the statement, “In a good software development team, we’d find TDD as well as CI.” There are numerous color screen snapshots depicting configuration of Jenkins. Appendix B also discusses the “Agile development methodologies Scrum and Kanban.” After briefly discussing Agile in general and providing a reference to the Agile Manifesto, Appendix B focuses on Scrum and Kanban specifically.
- Test-Driven Development with Mockito attempts to cover numerous topics within its roughly 150 pages.
- The title nicely captures two of the most significant topics of the book: Test-Driven Development and Mockito. It is important to note that this book is on both subjects, among others, and is not exclusively a book on test-driven development or exclusively a book on Mockito.
- Topics related (in some cases less tightly than others) to test-driven development that are covered in this book include refactoring, object-oriented design practices and principles, and agile methodologies.
- The advantage of this coverage of a wide set of somewhat related topics is that a developer new to test-driven development can get an introduction to a wide variety of related topics. The disadvantage of this approach is that there is less depth on any one subject that books more tightly focused might have. To this point, note how long each of the books listed below is in terms of the single topic each book covers. Each of these books is lengthier on a single topic than Test-Driven Development with Mockito is for all of the topics. Test-Driven Development with Mockito allows a reader to get a taste of each of these topics and how they fit together in a single book, but thorough coverage of the topics would need to be gained by moving onto these specifically focused books.
- Martin Fowler‘s Refactoring: Improving the Design of Existing Code has over 450 pages devoted to refactoring.
- Kent Beck‘s Test-Driven Development: By Example has well over 200 pages.
- Design Patterns: Elements of Reusable Object-Oriented Software has over 400 pages.
- Robert Martin‘s Clean Code: A Handbook of Agile Software Craftsmanship is over 450 pages in length.
- Tomasz Kaczanowski‘s Practical Unit Testing with JUnit and Mockito has over 400 pages.
- Lasse Koskela‘s Effective Unit Testing: A Guide for Java Developers has almost 250 pages.
- Test-Driven Development with Mockito has several nice images. I especially like the screen snapshots that depict Eclise refactoring keyboard shortcuts and the screen snapshots that depict Jenkins configuration. An advantage of my reviewing the PDF provided by Packt Publishing is that these images are in full color.
- The code listings are useful in illustrating the points being made, but the lack of color syntax (even in the electronic PDF version) make it more difficult to read the code quickly and easily. I have become spoiled by my IDE (and even my vim!) and online code listings featuring color syntax. Reading code without color syntax reminds me of the “old days,” but the nostalgia is not worth the extra effort required to read the code.
- Test-Driven Development with Mockito has some typos in it and also has some awkward and incomplete sentences. However, none of these were significant enough to prevent me from picking up the concept being covered.
- Although the flow of topics covered in Test-Driven Development with Mockito generally made sense, there were some aspects of the arrangement of the various concepts that were a bit awkward. In particular, there were a couple concepts that were presented in almost a “side note” manner at first and were not very clearly explained, but then were much more clearly explained in the later sections that focused on that topic.
- As is the case with just about every TDD-related book I have read, Test-Driven Development with Mockito is a highly opinionated book. Although I generally agreed with most of the opinions, I felt some of the stated opinions were backed up better than others and some I don’t feel quite as strongly about or think are quite as certain as the author does. That being stated, I do like to see opinions expressed and I generally agreed with them in principle. The more focused books I mentioned in an earlier bullet would be useful for the reader of Test-Driven Development with Mockito who wanted to better understand the “why” behind some of the opinions expressed in this book.
Conclusion and Recommendation
Test-Driven Development with Mockito will be most beneficial to readers who have little to no familiarity with the numerous concepts introduced in the book (test-driven development, refactoring, object design, JUnit, Mockito, etc.). The book provides an overview of each of these and how they are used together. Developers who have read other books on these subjects may not find the introductory information in Test-Driven Development with Mockito as useful or as new to them. Developers wanting in-depth coverage of a topic might prefer a book focused on that particular topic. The book is most useful for those using the Eclipse IDE, but many of the sections are useful for developers who don’t use Eclipse.
Posted in Book Review, Syndicated, Unit Testing Comments Off on Book Review: Test-Driven Development with Mockito
Book Review: Mastering HTML5 Forms
When I accepted Packt Publishing’s offer to review the recently released book Mastering HTML5 Forms, I was curious about what an entire book would cover related to HTML5 forms. Although they are relatively basic when compared to some of HTML5’s other f… Continue reading
Posted in Book Review, HTML5, Syndicated Comments Off on Book Review: Mastering HTML5 Forms
Book Review: Groovy 2 Cookbook
I was excited to review Groovy 2 Cookbook (Packt Publishing, 2013) by Andrey Adamovich and Luciano Fiandesio because I have been very happy with two other cookbook-style Groovy books (Groovy Recipes: Greasing the Wheels of Java [Pragmatic Programmers, … Continue reading
Posted in Book Review, Groovy, Syndicated Comments Off on Book Review: Groovy 2 Cookbook
Book Review: Gradle: Beyond the Basics
Gradle: Beyond the Basics is the “sequel” to Building and Testing with Gradle. According to the Gradle Books page, a third book in this series will be a “set of recipes that uses as the demonstrative tool for enterprise build automation.” I have not r… Continue reading
Posted in Book Review, Gradle, Syndicated Comments Off on Book Review: Gradle: Beyond the Basics
Book Review: Java EE 7 First Look
Java EE 7 was formally released earlier this year. NDJOBO Armel Fabrice’s book Java EE 7 First Look advertises that the reader of this Packt Publishing book can “discover the new features of Java EE 7 and learn to put them together to build a large-sca… Continue reading
Posted in Book Review, Java EE 7, Syndicated Comments Off on Book Review: Java EE 7 First Look
Book Review: HTML5 Data and Services Cookbook
Packt Publishing recently published HTML5 Data and Services Cookbook by Gorgi Kosev and Mite Mitreski. The subtitle of the book is: “Over one hundred website building recipes utilizing all the modern HTML5 features and techniques!” I accepted an invita… Continue reading