Tuesday, January 17, 2012

Book Review: SQL Antipatterns Avoiding the Pitfalls of Database Programming

This is book for software developers that are either new to database programming (SQL) or those that may not have had any formal database education and may have learned 'on-the-job'.

The book is bit longer, approximately 300 pages, than some of the other titles I've read from The Pragmatic Programmers shelf, but it is a very easy read.  The chapters all follow a similar format: Object, Antipattern, How to Recognize the Antipattern, Legitimate Uses of the Antipattern and Solution.  Each chapter the author leads you through a problem that needs correcting within the scope of the database.   Next the antipattern is laid out for you and the author shows the disadvantages of using the antipattern.   Tips are provided to help identify the antipattern and he also suggests some possible legitimate uses of the antipattern.  Finally, the author describes better solutions to the problem presented; ones without the disadvantages discussed previously and solutions that are considered 'best practices' and that will provide better database performance.

The book is broken down into 4 main sections:

  • Logical Database Design Antipatterns - planning database tables, columns and relationships
  • Physical Database Design Antipatterns - defining tables, indexes and choosing  datatypes
  • Query Antipatterns - SQL command usage, for example, SELECT, UPDATE and DELETE
  • Application Development Antipatterns - correct usage within the scope of a language
Some of that antipatterns described may make you laugh and wonder, "Who the heck would do something like that?" while others you may have run into previously and some might even hit very close to home from your work or personal projects.

There is also an appendix that covers the Rules of Normalization.  I had heard of terms like Normalization, First Normal Form, and Second Normal Form before, but never actually read any explanations. The appendix includes discussions on normalization and first normal form through fifth normal form with examples to help clarify the topics. 

This is a very good book for software developers just starting to 'cut their teeth' with databases and SQL.  It also serves as a good refresher for those with a bit more database experience.  In my case, I fall into the later scenario.  You can view it as a book of short stories, showing what not to do in these cases.

No comments:

Post a Comment