About This Book

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.

Who should read this book

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.

Roadmap

The book is divided into 11 chapters.

  • Chapters 14 provide a thorough introduction to testability and the reasons for using dependency injection, its various design patterns, and usage idioms, particularly how to choose these patterns and apply them in various situations.

  • Chapters 56 focus on scopes, which, are a way of managing state in your application without polluting logic with infrastructure concerns. They also explore deep problems with common idioms such as the static singleton anti-pattern and solutions using dependency injection, and examine scopes for web applications and other purposes.

  • Chapter 7 talks about how to manage your application's lifecycle via the dependency injector. This involves sending objects notifications of important events in the life of the application and designing custom lifecycle infrastructure for your own uses.

  • Chapter 8 deals with aspect oriented programming (or AOP) as it applies to dependency injection, how it helps save on boilerplate code, and reduces the risk of errors. A large part of this chapter is devoted to potential problems and pitfalls in using this powerful technique.

  • Chapters 911 investigate concurrency and design and look at case studies in performance, design, and design integration with third party frameworks. Chapter 11 is a case study on how to build a complete web application using the concepts presented throughout the book.

Finally, there are two appendixes that discuss alternate approaches to dependency injection frameworks, SmartyPants for Flex and the Butterfly Container.

Code conventions and downloads

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.

Software requirements

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.

Author Online

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/Dependency-Injection. 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.32.73