About this Book

This book is intended for developers who work on both greenfield and brownfield projects. We’ve tried to cover content that will be thought-provoking for developers of many different skill levels. As a result, the discussions range from being very high-level all the way down to raw code.

We’ve split the book into two parts: “The ecosystem” and “The code.” In our experience they’re the two major areas where we encounter issues on a brownfield project. It made the most sense to us to discuss the ecosystem in part 1 because it sets the foundation for being able to do many different things with any project.

In part 1, we decided to cover everything from the most obvious (we hope), version control, through continuous integration (CI), automated testing, metrics, and defect tracking in the order that we generally approach them on a brownfield project.

Some would, and did, argue that automated testing should come before continuous integration. We disagree. There’s no prerequisite to have automated tests before implementing CI. Having a CI environment that compiles the codebase on each code check-in will add an enormous benefit to any project, brownfield or not. In the end we do want to strive for CI that executes automated tests, but waiting to implement CI until your project has a functioning test may be putting off a process that could solve some problems you may be encountering.

That said, feel free to wait until you have functioning automated tests before you implement CI. This book reflects the order that has worked for us in the past. Every project is different. CI before automated test, or vice versa, could vary depending on what you encounter when joining a brownfield project.

Part 2 is dedicated to code techniques and practices that we feel can benefit all the “-abilities” (maintainability, readability, extensibility, reversibility...). Again, there’s no magic formula for which order they should appear. In the name of flow and simplicity we decided to start with fundamentals (OO concepts, layering) and then address the main areas of the application working from the user interface to the data access layer.

Again, you can address any one before the other, but with regard to the application tiers, we’ve found the most benefit and easiest refactorings to occur when working from the UI layer toward the data store. Our experience has shown that working with “consumer” code (code that calls other code) allows us to better see how the code being called needs to be organized and formulated. If you write the UI tier to call the service layer in the way that makes most sense for the UI, then the service layer’s exposed API/interface will be as efficient and meaningful as possible. That alone will help you to improve the “-abilities” of your codebase.

Roadmap

A brief summary of what you will find in each chapter follows:

Chapter 1 explores the foundation of what brownfield projects are and some of the issues that are commonly found when working on them.

Chapter 2 starts our discussion on the development ecosystem with version control systems and how they can be used to benefit both brownfield and greenfield projects.

Chapter 3 tackles the idea of continuous integration and adding automated build scripts to an existing project.

Chapter 4 looks at automated testing fundamentals, managing existing tests on a brownfield project and how to approach adding automated testing to an existing project.

Chapter 5 delves into metrics and code analysis to explore how the ideas and tools can help you get a better handle on an existing code base.

Chapter 6 covers the oft-forgotten defect tracking component of any project. The chapter takes a long look at how to manage existing defect backlogs and how to use past defects to direct your development efforts.

Chapter 7 introduces the code-specific portion of the book by discussing object-oriented fundamentals. This chapter lays the foundation for coding practices that will be suggested and discussed through the remainder of the book.

Chapter 8 explores layering of code in an application both at a conceptual level as well as what efforts and approaches will be beneficial when working in a brownfield code base.

Chapter 9 covers decoupling a code base through the use of interfaces, dependency inversion, and inversion of control containers, both in general and specifically for existing code bases.

Chapter 10 is dedicated to discussing user interface patterns and how they pertain to a brownfield project.

Chapter 11 tackles the sticky subject of data access from both theoretical and practical brownfield standpoints.

Chapter 12 explores the problems introduced by third-party dependencies and how to manage them within a code base.

Chapter 13 wraps up the book with a discussion about how to keep the momentum built through the book to continue to flow in your projects.

Sidebars

Interspersed through the book you’ll find a couple of different types of sidebars. One is titled “Tales from the trenches.” These are real-life situations we’ve encountered or instigated. Hopefully you can learn from some of our mistakes and successes.

Another common sidebar is “Challenge your assumptions.” When we started working on the book, we wanted to present some ideas that stretched readers out of their traditional comfort zones. Although there are a number of these sidebars in the book, don’t stop when you’ve finished reading them. Constantly look at the situations you’re in and consider options and thoughts that push boundaries. There’s a lot of great content on the internet that presents ideas that would fall into this category. Make the time to search out the sources of this content. Consider their ideas and see if they apply to your situations. You’ll use some and you’ll discard more. The thing is, you’ll be putting yourself into a mind-set to do what is best for the project, not just what is “normal.”

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. Code annotations accompany some of the listings, highlighting important concepts. In most 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/BrownfieldApplicationDevelopmentin.NET. The code available for download requires Visual Studio 2008 or higher.

Author Online

Purchase of Brownfield Application Development in .NET includes free access to a private web forum run by Manning where you can make comments about the book, ask technical questions, and receive help from the authors and from other users. To access the forum and subscribe to it, point your web browser to www.manning.com/BrownfieldApplicationDevelopmentin.Net. This page provides information on how to get on the forum once you’re registered, what kind of help is available, and the rules of conduct on the forum.

Manning’s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the authors can take place. It’s not a commitment to any specific amount of participation on the part of the authors, whose contribution to the book’s forum remains voluntary (and unpaid). We suggest you try asking the authors some challenging questions, lest their interest stray!

The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

Sample project and living ideas

In addition to the Author Online forum, this book is supported by a website (www.brownfieldappdev.com) that contains living records of our experiences and tools. It also hosts a sample brownfield refactoring project that outlines and demonstrates many of the techniques espoused in this book.

About the authors

Kyle Baley is uncomfortable talking about himself in the third person so he’d just like to say he’s a guy who writes code for a living.

Donald Belcham is just another developer trying to be as productive, professional, and client-focused as possible.

About the cover illustration

The figure on the cover of Brownfield Application Development in .NET is “The Merchant,” taken from a late 18th century edition of Sylvain Maréchal’s four-volume compendium of regional dress customs published in France. Each illustration is finely drawn and colored by hand. The rich variety of Maréchal’s collection reminds us vividly of how culturally apart the world’s towns and regions were just 200 years ago. Isolated from each other, people spoke different dialects and languages. In the streets or in the countryside, it was easy to identify where they lived and what their trade or station in life was just by what they were wearing.

Dress codes have changed since then and the diversity by region, so rich at the time, has faded away. It is now hard to tell apart the inhabitants of different continents, let alone different towns or regions. Perhaps we have traded cultural diversity for a more varied personal life-certainly for a more varied and fast-paced technological life.

At a time when it is hard to tell one computer book from another, Manning celebrates the inventiveness and initiative of the computer business with book covers based on the rich diversity of regional life of two centuries ago, brought back to life by Maréchal’s pictures.

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

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