Refactoring has proven its value in a wide range of development projects—helping software professionals improve system designs, maintainability, extensibility, and performance. Now, for the first time, leading agile methodologist Scott Ambler and renowned consultant Pramodkumar Sadalage introduce powerful refactoring techniques specifically designed for database systems.
Ambler and Sadalage demonstrate how small changes to table structures, data, stored procedures, and triggers can significantly enhance virtually any database design—without changing semantics. You'll learn how to evolve database schemas in step with source code—and become far more effective in projects relying on iterative, agile methodologies.
This comprehensive guide and reference helps you overcome the practical obstacles to refactoring real-world databases by covering every fundamental concept underlying database refactoring. Using start-to-finish examples, the authors walk you through refactoring simple standalone database applications as well as sophisticated multi-application scenarios. You'll master every task involved in refactoring database schemas, and discover best practices for deploying refactorings in even the most complex production environments.
The second half of this book systematically covers five major categories of database refactorings. You'll learn how to use refactoring to enhance database structure, data quality, and referential integrity; and how to refactor both architectures and methods. This book provides an extensive set of examples built with Oracle and Java and easily adaptable for other languages, such as C#, C++, or VB.NET, and other databases, such as DB2, SQL Server, MySQL, and Sybase.
Using this book’s techniques and examples, you can reduce waste, rework, risk, and cost—and build database systems capable of evolving smoothly, far into the future.
Review By: Lorne Schachter 02/18/2012I once worked on a project where we had to migrate a very large, standalone Microsoft Access database over to Sybase and then integrate it into our processing system. Due to the usual time pressures, we did a straight translation of the stored procedures and moved the data over, without really going through the process of understanding both the stored procedures and the database schema. Once the database had been brought over as is, we went through the process of integrating it into the processing stream. When the process was upgraded and rewritten, we decided to upgrade the database, also. The only problem was that no one knew what was going on. There was a tremendous amount of code in the stored procedures that was not commented and was duplicated. Lots of code was commented out with no description of why it was taken out and what problems the replaced code was designed to solve. The transition and upgrade was eventually successful, but the whole process was incredibly painful and full of problems.
Refactoring Databases would have made the process a whole lot easier and kept it under control. Ambler and Sadalage meticulously go through all the types of modifications that might have to be made as part of the refactoring operations, with sample code and flow charts throughout the book. Particular emphasis is placed on the structural refactoring of the database, where each section covers the motivation for that type of change, potential tradeoffs that are involved in the implementation of the change, and descriptions of the schema updates, data migration, and program access changes that are involved in the operation. They also stress the need for refactoring to address data quality issues and give the same descriptions of those changes.
My biggest issue—if you can call it that—with the book is its intended audience. The book is very comprehensive and should belong on the bookshelf of any project manager or database administrator, but anyone with experience should know most, if not all, of the issues involved and might find the book somewhat pedantic. On the other hand, junior programmers or DBAs would not normally be entrusted with a task of this magnitude without a senior person watching over them, so they might not find the book useful. If you're a DBA or a project manager who has to worry about database refactorings, all the information you need is here; it just might take you some time to get to it.