Spring Patterns: Best Practices and Design Strategies Book Review
This is a book review of Pro Java™ EE Spring Patterns: Best Practices and Design Strategies Implementing Java EE Patterns with the Spring Framework
About the Book
Pro Java™ EE Spring Patterns focuses on enterprise patterns, best practices, design strategies, and proven solutions using key Java EE technologies including JSP™, servlets, EJB™, and JMS APIs.
This Java EE patterns resource, catalog, and guide, with it’s patterns and numerous strategies, documents and promotes best practices for these technologies, implemented in a very pragmatic way using the Spring Framework and it’s counters.
The book was written by Dhrubojyoti Kayal. Dhrubojyoti works as a senior consultant with Capgemini Consulting. He has more than five years of experience developing and designing applications and products leveraging Enterprise Java technologies. His areas of interest include the Spring Framework, ORM, SOA, refactoring, prefactoring, and performance engineering.
In this book the author takes us through the process of refactoring a legacy system built without using patterns or the Spring Framework into a shiny new system leveraging Spring and design patterns. Throughout the book he takes us through this practical, real-word example.
Introduction to the MVC Pattern
The first chapter introduces you to the MVC pattern. I think that this book is for a well versed J2EE professional developer, who would probably be familiar with the pattern, so this chapter may have been overkill. However, the basis of this book is to refactor an antiquated web application to use Spring and the Spring MVC, so a clear and thorough understanding of the MVC pattern is necessary. Most readers of this book can probably skip this chapter. On the other hand it is written well enough that it would serve a good resource for any rookie developers that you might be working with who need to learn this pattern.
Patterns
Each chapter of this book takes you through the concepts of a common pattern, describes how the Spring Framework is used to implement that pattern, and then replaces the legacy insurance system code with new spring code. Once you get into the patterns, the book is divided into four major sections. These sections are
- Presentation Tier Design Patterns
- Business Tier Design Patterns
- Integration Tier Design Patterns
- Crosscutting Design Patterns.
This division helps to keep the conversation between the author and the reader focused and also makes it easy to find later when you come back to reference this information.
The Best Part
My favorite part about this book is that it is a patterns book. I like to read books based on patterns more than any other type of book. Patterns books are naturally broken down into small, manageable chunks of information. When written, patterns are usually described using a common, easy to follow template and are small enough to read an entire pattern in one sitting, whether that sitting be while you are eating your lunch or a quick read before hitting the pillow. Because they are written this way, it is easy to read this book very quickly and easy to find what you are looking for when you come back later for specific information. Pattern-based books are great.
I also liked this book because it takes you through all the layers of a real-world system. As developers we all have to work with legacy code. If you don’t your very lucky. Because this is real world it is very easy to follow along with the author and the project and see the benefits of Spring and refactoring to patterns.
Needs Refactoring
It’s a good, well-written book, but there are some things that I think need to be changed.
First, as with any book with code examples, there is some odd code that should be rewritten or removed. For example, there is a business bean that has a DAO injected into it via a setter. However, this bean also contains a getter for that DAO. This is not common practice and, in my opinion, not recommended.
And second, all of the presentation patterns are in a single chapter, and all of the business and integration patterns are in their own chapters. I think each pattern should have had its own chapter. I just prefer the clearer boundaries between patterns and I think it would make finding these patterns later, when I come to reference the book, a little easier.
You Should Read this Book
You should read this book if you are a developer who uses Spring, and especially if you use Spring MVC. This is a great resource and a great way to learn about how Spring utilizes patterns internally to implement its services. Of course it also shows you how to use Spring to add patterns to your current code base. You should read this book if you use an MVC framework that is not Spring MVC and are considering Spring MVC for your next project or are considering adapting Spring MVC to your current project. While this book deals with more than just the Spring MVC, the entire presentation tier section is based on it.
Or Not…
I do recommend this book to most developers, however you should not read Spring Patterns if you are not well versed with J2EE/JEE and the Spring framework. If you are looking to learn Spring, there are other books that might be more suitable.
Here are some last notes, straight from Apress, about this book:
- What you’ll Learn:
- Get an introduction to enterprise Java/Java EE application design patterns.
- Simplify enterprise Java design using the popular Spring Framework.
- Examine presentation, business, web, and integration tier design patterns and best practices, including cross–cutting design patterns, AOP, etc.
- See how the enhanced and up–to–date pattern catalog compares to core J2EE design blueprints.
- Learn how to use comprehensive source code and configuration information.
- Develop order management system requirements for the first in–depth enterprise application case study.
- Design your order management system application using the final case study.
Table of Contents
Finally, here is the table of contents:
ASP.Net MVC Book Review and musings
ASP.Net MVC musings
- ASP.Net MVC is a CoC MVC framework, it’s not a “full stack” framework. You still need to implement some type of database layer.
- Traditional ASP.net web forms attempts to hide the core parts of web development HTML, JS, CSS. ASP.Net MVC does not.
- Learning a pattern like MVC in web framework that allows developers to be aware of HTML, JS, CSS will only benefit you as a web developer.
- If you actually understand how web pages work it makes you a better debugger and a more well rounded programmer. You are able to more easily apply your knowledge and skill set to other languages/platforms. I know that some web form developers do know the details of web development, but in my opinion most do not.
- The fact that ASP.Net MVC makes it easier to test will not appeal to people who have never written a unit test in their life. You have to convince such people by showing a real world example demonstrating how test coverage can save you loads of time and money in the maintenance phase of application development. But at that point you will only get architects and project managers to buy in, the lazy developers that fear learning anything new will still avoid ASP.Net MVC like the swine flu.
- The fact that the MVC pattern is a common pattern among other web development environments such as Java and PHP will also not appeal to most Microsoft developers. However the really smart ones will realize that more common knowledge will only help if you ever have to do any type of development other than microsoft development
Book Review – Pro ASP.Net MVC Framework – Steven Sanderson

Book on Amazon I am a Java, PHP, and .Net developer which may make my opinion worthless to some Microsoft zealots but I thought I would type up my thoughts on this book anyway. Overall I found this book to be a great way to learn ASP.Net MVC. It has great examples and enough background material to bring people new to the MVC pattern up to speed. Below are my pros and cons along with notes on chapters 1-13.
Note about the cover.
One thing I found interesting is that the cover says “Discover the biggest innovation in Microsoft web development since asp.net 1.0″. I find it amusing that something as old as MVC web frameworks can be called an innovation for asp.net development since MVC frameworks are nothing new to web development. Heck they are not even new to ASP.Net development. See MonoRail .
Pros
- Provides good definition of MVC and explains why you want to use it
- Overall all the examples are clear and concise
- Gives examples of how to test every part of ASP.Net MVC
- Moves quick enough for someone with MVC experience and slow enough for someone with no MVC experience
- Great chapter on web site security
- Book often demonstrates C# 3 language features
Cons
- Database examples use LINQ to SQL.
- As many have noted this isn’t a major con. It was probably used to keep the examples shorter. Whether you like LINQ to SQL or not that is a good thing.
- No mention of Mono project or any hints of how to get ASP.Net working with Mono.
- Book examples are for the “real” version of VS2008 not the free VWDE2008.
- Does not provide a good example of using a validation utility such as XVal or Data Annotations
Chapter 1
- An adequate history lesson for those unfamiliar with MVC.
Chapter 2
- A great chapter that quickly and easily shows you the basics of ASP.Net MVC
Chapter 3
- Gives in depth definition to each part of MVC
- Gives good definition of entities vs value objects
- Lists design and pattern best practices
- Brief discussion of IoC and IoC containers
- Brief discussion on automated testing and the TDD movement
- Gives example of creating mock implementations for testing
Chapter 4
- Goes into medium depth while building a project with unit testing, domain model, and web layer
- uses LING to SQL for database interactions
- Sets up IoC with Castle Windsor
- Shows how to use Nunit and Moq to create unit tests
- Good definition of TDD and how the author thinks of it as actually BDD (behaviour driven development)
Chapter 5
- Examples of how to test every part of ASP.Net MVC
- Shows example of how to only expose an interface in your controller to avoid tying the controller to your business logic implementation
Chapter 6
- CRuD actions and views are added to the example project
- Example of username/password authentication
- Shows how to upload an image through a form field
Chapter 7
- Detail of asp.net MVC project folder structure
- Very well done, explains the what/why for each folder
- Goes over the naming convention which are crucial since ASP.Net MVC follows CoC
Chapter 8
- Everything you need to know about how url routing works and also how to create links in your application to your controllers/actions
Chapter 9
- More details on what code belongs in a controller/action
- More details on how the views are rendered
- Example of how to use the [Authorize] filter attribute, which is a great way to easily secure your actions individually
Chapter 10
- Details on how views work specifically how data is passed between layers and tools available to display that data. Specifically the HTML helpers.
Chapter 11
- Everything you need to know about how to modify and configure how data is retrieved from forms and urls and then binded to action parameters and model objects
- Validation
- Author basically suggest using plain c# in the model layer for validation. doesn’t list the re-usability and “all ready done for YOu” benefits of using a validation utility.
Chapter 12
- Simple examples of how to use the AJAX HTML helpers which includes JQuery.
Chapter 13
- Demonstrates basics of HTTP requests to help you understand how vulnerable web sites are. Really good reading for less experienced web developers.
- Gives example of how to fake an http request
- Gives examples of using tools like firebug and fiddler
- Details cross-site scripting and html injection
- Details how one of the previous chapter examples had a vulnerability and how it can be fixed






