This book is intended for newcomers to dependency injection as well as for seasoned framework users. It is a guide to design patterns and best practices when using dependency injection, an increasingly indispensable tool in any programmer’s arsenal.
The book is for anyone who writes code and is interested in learning best practices for designing large, developer-scale applications. It is also intended for an audience of architects and professionals seeking to identify and correct common anti-patterns in design. All the examples are written in Java using Spring or Guice. But the lessons apply equally to other statically typed languages like C#. Whether you’re a developer, architect, team lead, or novice programmer, you will find this book useful.
The book is divided into 11 chapters.
Finally, there are two appendixes that discuss alternate approaches to dependency injection frameworks, SmartyPantsIOC for Flex and the Butterfly Container.
All source code in listings or in the text is in a fixed-width font like this to separate it from ordinary text. In listings, bold code indicates code that has changed from the previous example, or that will change in the next example. Code annotations accompany some of the listings, highlighting important concepts. In some cases, numbered bullets link to explanations that follow in the text.
You can download the source code for this book from the publisher’s website at www.manning.com/DependencyInjection.
To use the code in this book, you need the Sun Java SDK (which is free) running on Linux, Windows, or Mac OS X. You’ll also find it useful to download libraries for the Spring Framework (http://springframework.org) and Google Guice (http://code. google.com/p/google-guice). Both are open source and free to download from the links provided. Other tools will be referenced where they’re relevant. At your discretion you may choose to use a Java IDE such as IntelliJ IDEA, but this is not strictly necessary.
Purchase of Dependency Injection includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum and subscribe to it, point your web browser to http://www.manning.com/DependencyInjection. This page provides information on how to get on the forum once you are registered, what kind of help is available, and the rules of conduct on the forum. It also provides links to the source code for the examples in the book, errata, and other downloads.
Manning’s commitment to our readers is to provide a venue where a meaningful dialog between individual readers and between readers and the authors can take place. It is not a commitment to any specific amount of participation on the part of the author, whose contribution to the Author Online remains voluntary (and unpaid). We suggest you try asking the author some challenging questions lest his interest stray!
You can also ask the author a question at http://twitter.com/dhanji.