Data Access Patterns: Database Interactions in Object-Oriented Applications

  Author:    Clifton Nock
  ISBN:    0131401572
  Sales Rank:    235806
  Published:    2003-09-15
  Publisher:    Addison-Wesley Professional
  # Pages:    480
  Binding:    Hardcover
  Avg. Rating:    4.0 based on 7 reviews
  Used Offers:    12 from $50.38
  Amazon Price:    $50.38
  (Data above last updated:  2008-10-06 07:25:17 EST)
  
  
Sort customer reviews by:
  
Show All Reviews on Page      Hide All Reviews on Page
   
  
Data Access Patterns: Database Interactions in Object-Oriented Applications
  
Preface Data is a major element in the foundation of any enterprise.Accountants make and defend decisions using financial data.Manufacturers and purchasers rely on stock and order data to temperinventory. Salespeople study customer history data. Executive managementdepends on data to examine company controls. Enterprise software enables these key decision-makers to read, write,and organize data. Data access facilities within business applicationsplay an important role in their quality and usability. Developers mustexert considerable effort to design efficient data access code,otherwise an entire application may appear to be slow or prone todefects. Data Access Patterns Enterprise software developers tackle the same dataaccess problems regardless of their application domain. These are someexamples of common issues that arise when designing data accesscomponents: Applications need to work with multiple database products. User interfaces need to hide obscure database semantics. Databaseresource initialization is slow. Data access details make application code difficult to develop and maintain. Applications need to cache data that they access frequently. Multiple users need to access the same data concurrently. There are common solutions to these problems. Some ofthese solutions are intuitive and have been discovered independently byliterally thousands of developers. Others are more obscure, and havebeen solved in only the most robust data access solutions. Data access patterns describe generic strategies for solving commondesign problems like these. A pattern does not necessarily dictate aparticular implementation. Instead, it describes an effective design andstructure that form the basis for a solution. This book describes patterns that apply specifically to relational dataaccess. Relational databases are by far the most prevalent and provendata storage mechanism that enterprise software uses today. Otherpersistence technologies, like object-oriented and hierarchicaldatabases, are gaining in popularity. These alternative databases storedata closer to its runtime object form, so conventional object-orienteddesign patterns and techniques apply more readily. Who Should Read This Book? This book is intended for softwarearchitects, designers, and engineers who are responsible for buildingdata access software components. In addition, the material in this bookis also appropriate for students who wish to understand common dataaccess problems and solutions. This book describes data access patterns using common database andobject-oriented concepts and terminology. It is expected that the readerhas a basic familiarity with both of these. If you run across a termthat is not familiar to you, please consult the glossary at the end ofthe book. The patterns in this book apply to many platforms, programminglanguages, and databases. The sample code for each pattern is writtenusing the Java 2 Standard Edition (J2SE), Java 2 Enterprise Edition(J2EE), and Java Database Connectivity (JDBC) APIs. The sample codeexpresses database operations using Structured Query Language (SQL). Abasic understanding of Java and JDBC is helpful when studying thissample code, but it is not essential. Comments and explanationsaccompany any code that is not straightforward. How This Book Is Organized This book is a pattern catalog. It describes a set of dataaccess patterns in detail. The parts of the book group multiple patternsbased on their applicability. Since it is a catalog, do not feelcompelled to read the pattern descriptions in order. If a patterndepends on concepts that another pattern defines, it clearly states thisfact. Patterns are identified by concise, descriptive, and familiar names.Pattern names are significant because you can use them in conversationand documentation. It is much more effective to describe a set ofinteracting classes as an instance of Resource Decorator than torepeatedly describe each element of a pattern in detail. This book's "Introduction" presents the motivation for studying andapplying data access patterns. It briefly introduces each pattern. Thischapter also defines the form that subsequent chapters use fordescribing pattern details. The remainder of the book is the pattern catalog, divided into parts foreach pattern category: Part 1, "Decoupling Patterns," describes patterns that decouple dataaccess code from other application logic, resulting in cleanerapplication code that is less susceptible to defects caused by changesthat relate only to data access details. Part 2, "Resource Patterns,"describes patterns for efficient database resource management. Part 3,"Input/Output Patterns," describes patterns that simplify data input and output operations using consistent translations between relational data in its physical form and domain object representations. Part 4, "CachePatterns," describes patterns that enable strategic data caching and address the tradeoffs between data access optimization and cache overhead. Part 5, "Concurrency Patterns," describes patterns that implement concurrency strategies. The inside front cover provides a reference listing of the patterns in this book and their descriptions.As you become familiar with the book's structure and the pattern form,you may find this listing convenient for identifying and quicklylocating a specific pattern. Summary Like any other pattern catalog, this book is not exhaustive. Youare encouraged to tweak the solutions to fit your applications anddiscover new data access patterns along the way. Using and identifyingpatterns is beneficial, even if you do not document them as formally asthose in this book. I am genuinely interested in any feedback and insight that you haveregarding the patterns described here. You can write me in care ofAddison-Wesley or send e-mail to dataaccesspatterns@awl.com.
                  Reader Reviews 1 - 11 of 11                 
  
  
Review
Date
Review
Rating(5 High)
Review
Helpful
to:
Customer Review Reviewer
Info
Permanent
Link
Reader Reviews Below Sorted by Newest First
12-14-06 3 0\1
(Hide Review...)  There is better one
Reviewer Permalink
Try Martin Fowler's Patterns of Enterpise Application Architecture.

It has much better coverage in more useful context.

Also you can look at Hibernate or iBatis project for real application

of these patterns.
(Review Data Last Updated: 2007-09-07 19:59:59 EST)
12-14-06 3 0\2
(Hide Review...)  There is better one
Reviewer Permalink
Try Martin Fowler's Patterns of Enterpise Application Architecture.
It has much better coverage in more useful context.
Also you can look at Hibernate or iBatis project for real application
of these patterns.
(Review Data Last Updated: 2008-03-03 13:23:47 EST)
12-13-06 3 0\3
(Hide Review...)  There is better one
Reviewer Permalink
Try Martin Fowler's Patterns of Enterpise Application Architecture.
It has much better coverage in more useful context.
Also you can look at Hibernate or iBatis project for real application
of these patterns.
(Review Data Last Updated: 2008-10-04 05:04:38 EST)
12-11-04 4 4\4
(Hide Review...)  Useful patterns and interesting concepts
Reviewer Permalink
The book presented 25 patterns grouped in 5 areas, decoupling (conceptual and architectural level), resource, input/output, cache and concurrency.

The most interesting patterns are in resource and cache. Decoupling and concurrency patterns (e.g., data accessor, active domain object, layers, transactions, optimistic/pessimistic lock etc.) are well known and the contents are a bit too light to be very useful, yet the concepts are giving readers some directions.

In resource patterns, some interesting patterns are presented, particularly resource timer automatically releases inactive resource, retryer enables fault-tolerance for data access operations.

In cache patterns, cache collector purges entries whose presence in the cache no longer provides any performance benefits; cache replicator replicates operations across multiple caches.

There are some areas to be improved, first, author should consolidate pattern names with other pattern authors, e.g., data accessor is also known as data access object, active domain object is similar to active record, paging iterator is close to value list handler (though value list handler is more decoupled from underlying data store), the point is, one of the important benefits and purposes for documenting patterns is to build common vocabularies among designers, using different names for same or similar patterns is defeating this purpose. The same pattern name should be used and may be presented as a variation of the original pattern.

Secondly, the examples given in the book is a bit too simple, sometimes, the examples might not justify or validate the interface abstraction is generic enough to handle real world problems, so some tweaking and modification to the pattern would be expected.

Overall, the book is well organized, and contents are easy to follow, most patterns come with class diagrams and sequence diagrams. Good for designers who want to decouple data access from rest of the application, utilize cache to minimize data access and thus boost application performance, manage resources in an efficient and leaking-proof way.
(Review Data Last Updated: 2007-06-25 17:04:52 EST)
12-10-04 4 4\4
(Hide Review...)  Useful patterns and interesting concepts
Reviewer Permalink
The book presented 25 patterns grouped in 5 areas, decoupling (conceptual and architectural level), resource, input/output, cache and concurrency.

The most interesting patterns are in resource and cache. Decoupling and concurrency patterns (e.g., data accessor, active domain object, layers, transactions, optimistic/pessimistic lock etc.) are well known and the contents are a bit too light to be very useful, yet the concepts are giving readers some directions.

In resource patterns, some interesting patterns are presented, particularly resource timer automatically releases inactive resource, retryer enables fault-tolerance for data access operations.

In cache patterns, cache collector purges entries whose presence in the cache no longer provides any performance benefits; cache replicator replicates operations across multiple caches.

There are some areas to be improved, first, author should consolidate pattern names with other pattern authors, e.g., data accessor is also known as data access object, active domain object is similar to active record, paging iterator is close to value list handler (though value list handler is more decoupled from underlying data store), the point is, one of the important benefits and purposes for documenting patterns is to build common vocabularies among designers, using different names for same or similar patterns is defeating this purpose. The same pattern name should be used and may be presented as a variation of the original pattern.

Secondly, the examples given in the book is a bit too simple, sometimes, the examples might not justify or validate the interface abstraction is generic enough to handle real world problems, so some tweaking and modification to the pattern would be expected.

Overall, the book is well organized, and contents are easy to follow, most patterns come with class diagrams and sequence diagrams. Good for designers who want to decouple data access from rest of the application, utilize cache to minimize data access and thus boost application performance, manage resources in an efficient and leaking-proof way.
(Review Data Last Updated: 2006-12-13 11:37:34 EST)
05-11-04 5 3\3
(Hide Review...)  Great book on persistence theory
Reviewer Permalink
I'm in the middle of developing yet another persistence framework for a client, having done it a couple of times before. Each time I refine my ideas about how to do it. I must say that this book has a thorough examination of issues and certainly food for thought as well as answers to a couple of questions I've had.

However, I wouldn't say it's a complete design (which it doesn't claim to be). I still found myself picking and choosing which patterns to use as is, which to modify to my liking, and which to discard.

Also, I was left with the impression that the book didn't give enough coverage to handling collections of objects. The material is mostly geared toward working with a single object, which is understandable. I just think it would have been helpful to have more discussion about handling collections. For example, what should happen when you request to load an object, but the criteria you passed to the loading mechanism results in data for more than one object being retrieved from the database? Hand back the first object? Raise an exception? If it's covered in the book, I missed it.

Further, I would like to see more discussion about WHEN to refresh an object from the underlying database and when to save to the database. I always struggle with that timing issue. Having studied EJB, I like how entity beans keep your bean in synch with the underlying database. But the EJB container intercepts calls and makes those things happen. When coding the persistence layer myself, that's not an option. So, again, this is something I'd like to see some light shed on.

Overall, though, a great book if you're interested in reading up on persistence layer patterns.

(Review Data Last Updated: 2007-06-25 17:04:52 EST)
05-10-04 5 3\3
(Hide Review...)  Great book on persistence theory
Reviewer Permalink
I'm in the middle of developing yet another persistence framework for a client, having done it a couple of times before. Each time I refine my ideas about how to do it. I must say that this book has a thorough examination of issues and certainly food for thought as well as answers to a couple of questions I've had.

However, I wouldn't say it's a complete design (which it doesn't claim to be). I still found myself picking and choosing which patterns to use as is, which to modify to my liking, and which to discard.

Also, I was left with the impression that the book didn't give enough coverage to handling collections of objects. The material is mostly geared toward working with a single object, which is understandable. I just think it would have been helpful to have more discussion about handling collections. For example, what should happen when you request to load an object, but the criteria you passed to the loading mechanism results in data for more than one object being retrieved from the database? Hand back the first object? Raise an exception? If it's covered in the book, I missed it.

Further, I would like to see more discussion about WHEN to refresh an object from the underlying database and when to save to the database. I always struggle with that timing issue. Having studied EJB, I like how entity beans keep your bean in synch with the underlying database. But the EJB container intercepts calls and makes those things happen. When coding the persistence layer myself, that's not an option. So, again, this is something I'd like to see some light shed on.

Overall, though, a great book if you're interested in reading up on persistence layer patterns.

(Review Data Last Updated: 2006-07-07 09:25:17 EST)
02-29-04 5 5\5
(Hide Review...)  Good design pattern book in data access !!
Reviewer Permalink
I am in the process of writing a thesis proposal that utilizing JDBC and TableModeler to access various database platforms as a prototype.

While prototyping the model, I encountered a lot of consideration of what is the best approach for certain implementation (mainly on JDBC). While looking into a few of designing books, I found this Data Access Patterns book that fits into my research needs. I have read other book such as Designing Flexible Object Oriented System with UML and not able to apply the concept or see solution in it. It is simply a conceptual book. No practical examples at all.

Mr. Nock has explained the design patterns very clearly in each chapter by using JDBC as a media. The examples are very easy to understand as compared to Design Patterns Explained. I am not able to understand codes that implementing graphics in that book.

Mr. Nock addressed the pros and cons of the patterns. Many techie books do not even bother to talk about pros and cons.

The author has chosen the right title for the book, I realized that many times author received a poor rating because reader expect different contents based on the title of the book.

The feature I liked the most - the ˇ§Applicabilityˇ¨ section on each chapter. Unlike other patterns book, the author explains the concept and gives example of "what" and "when" to use certain design pattern. This section is pretty much the answer for my thesis obstacles. The answer is in this book!!

Minor typos do exist such as in page 390 roll back instead of rollback.

In concurrency chapter, author may have mis-used the term of updates locking. It should be Lost Updates instead of Missing updates. Concurrency chapter looks like UDB Lock Concurrency architecture.

Additional note - would like to see the quality aspect in each of the patterns.

Overall, the book is very well structured, explained and thoughtful.

Thank you Mr. Nock !! This is a perfect book for my thesis.

Looking forward to read your future publish.

Regards,

EQ

(Review Data Last Updated: 2007-06-25 17:04:52 EST)
02-20-04 5 16\20
(Hide Review...)  Excellent and Easy To Read
Reviewer Permalink
I have to disagree with the previous review. I will try to explain why I think 'b88zhou' review is inadequate after presenting my overview of this book.

After reading numerous pattern books, it is nice to see a pattern book with very good organization.

Each pattern is presented with the following subsections.

* Description
* Context
* Applicability
* Structure
* Iteractions
* Consequences
* Strategies
* Sample Code
* Related Patterns and Technology.

I specifically like 'Consequence' section because it outlines the 'bad' consequence of adopting the patter. This goes with the mantra of design patterns - there is no one good pattern. You trade off one design for another depending on the context of your domain.

Also each pattern is accompanied by UML class diagrams and UML sequence diagrams - this is a big plus in understanding pattern.

The sample code is written in Java/JDBC so you may need to understand Java but I believe this pattern is still relevant to ADO.NET and C++. [ ADO.Net does offer connected and disconnected database operation so some patterns may not be relevant - plus, event/delegate will aid in some patterns.]

Specific to what the previous reviewer say - here are my rebuttals.

>> Why do you want to make queries and database updates into factories? Looking at the sample code, does it really help decoupling?

The previous reviewer mentioned as 'factories' is the derivation of 'AbstractFactory'. If you do not understand why AbstractFactory aids in decoupling from the concrete implementation, I think you should re-read GoF book. The author uses AbstractFactory pattern extensively in context of "Input and Output Parameter" and "Cache Patterns". I do admit that sometimes "Input and Output Parameter patterns" may not need to use AbstractFactory but if you read 'Domain Assembler' pattern you will understand why. From Domain Assembler, you can see the benefit of having AbstractFactories for Selection, Domain Object, and Update -- assembling all these factories via interface not concrete implmentation - a basic idea of design to interface instead concrete implementation.

>> The "Cache Patterns" does not solve the problem of preventing stale entry or even attempt to describe how to invalidate cache entry, so no matter how efficient you get, the cache is not guaranteed to be up-to-date /correct.

Please re-read 'Cache Collector'. The pattern could have different name like 'Cache Garbage Collector'. He talks about how you can 'purge' old data. Also re-read 'Cache Replicator' for how to sync the cached data in distributed system.

>> I'm surprised "stored procedure" is not mentioned at all.

I guess you have not done too many DB oriented projects. The stored procedure is evil and add little value to OO programming. But if you want the stored procedure, just replace 'SELECT' or 'UPDATE' statements to whatever stored procedures you want to call. So I don't think you can add much with SP.

>> mature object/relational frameworks like EOF (Apple WebObjects) or TopLink

This book is not about Java Data Object or OR mapping. Object-Relational mapping tool is another beast.

I would recommend this book highly to anyone doing DB application development.

(Review Data Last Updated: 2007-06-25 17:04:52 EST)
12-09-03 3 14\20
(Hide Review...)  Not good enough.
Reviewer Permalink
Having read GoF's "Design Patterns" and "Design Patterns Smalltalk Companion" in the series, I grabbed this book as soon as I see it in store. But this book leaves a lot to be desired.

There seems to be the problem of having patterns just for the sake of having patterns.

For example, why do you want to make queries and database updates into factories? Looking at the sample code, does it really help decoupling?

To reviewer zhanggoo> The basic idea of "design to interface instead of concrete implementation" of course is always correct. I actually took the time and tried out the sample code of "input and output patterns" and got those working. However, you must realize that these patterns need a lot of re-thinking, redesign and refactoring once it's outside the realm of toy examples - How to handle domain object or selection criteria based on multiple-table-join (very common)? How to handle database generated identity? What if there needs to have a couple of selection factories for one domain object? Not to mention these patterns are all based on SQL string manipulations, static typing of the parameters all lost.

How come you can only get the first page from the "Paging Iterator"? Besides giving hints to JDBC, the pattern gives no control over the rows actually returned from the database.

The "Cache Patterns" does not solve the problem of preventing stale entry or even attempt to describe how to invalidate cache entry, so no matter how efficient you get, the cache is not guaranteed to be up-to-date /correct.

To reviewer zhanggoo> The author only talked about cache expiration - purge cache entry to enhance performance, but not invalidation (to prevent cache from getting inconsistent). Experienced database developer knows that query tuning is the first thing to look at to improve performance, one should take advantage of db server cache and app server cache as much as possible, as a last resort when you really need to roll your own cache, you need to make sure you get it right.

I'm surprised "stored procedure" is not mentioned at all.

To reviewer zhanggoo> There're certainly different opinions on "stored procedure". SP is definitely not OO, RDBMS is not OO at all - as long as you're using RDBMS, you have to face the fact that OO cannot be applied everywhere. On the other hand, SP helps greatly in decoupling, since query logic are not embedded in java code, app code and db code have clear interfaces, query optimization usually is easier to do with SP. These are good practices and patterns in my book.

The overall organization and format of the book is good, but for experienced database application developers, you might learn more by studying mature object/relational frameworks like EOF (Apple WebObjects) or TopLink.

(Review Data Last Updated: 2007-06-25 17:04:52 EST)
11-05-03 4 2\3
(Hide Review...)  Traditional data patterns with Object oriented programing
Reviewer Permalink
First of all this book is not about object relational mapping (ORM) strategies or patterns, the author provides a pattern that is the interface to a object relational mapping layer and that's it. This book is about traditional input output strategies to relational databases i.e. the layer under the object relational map if you were to build your own. However, if you were to build the data access object with traditional stratergies to the relational database you could use the patterns in this book, especially the cashing patterns which are sophisticated. I find the other patterns in connection pooling, I/O and transactions customary and should be known to most intermediate plus architects or programmers. The book is well documented in the UML with clear writing, good examples (case study) using Java JDBC. The patterns are generic, could be used in both .Net and J2EE. A fourth of the patterns come form Core J2ee or Fowler books.
(Review Data Last Updated: 2006-07-07 09:25:17 EST)
  
                  Reader Reviews 1 - 11 of 11                 
  
  
  
  
  
  

Because the data used to generate this site come from outside sources, VeryWellSaid.com cannot guarantee the completeness or accuracy of the data.
Search VeryWellSaid™
Google
Web VeryWellSaid™
New subjects are added every week.
View Subjects Below by:
* Top Selling
 (click category name, left)
* Top-Rated Top Sellers
 (click 'Top Rated', right)
In the news...  
Dubai\UAE Top Rated
Influenza\Bird Flu Top Rated
Iraq Top Rated
Supreme Court Top Rated
All Books Top Rated
Arts Top Rated
Photography Top Rated
Digital Photography Top Rated
Digital Cameras Top Rated
Biography Top Rated
Business Top Rated
Management Top Rated
Marketing Top Rated
Sales Top Rated
Stocks Top Rated
Bonds Top Rated
Real Estate Top Rated
Trading Top Rated
Commodities Trading Top Rated
Time Management Top Rated
Starting A Business Top Rated
Children's Top Rated
Comics Top Rated
Computers Top Rated
PC Top Rated
Mac Top Rated
Programming Top Rated
Design Patterns Top Rated
.Net Top Rated
C# Top Rated
Vb.Net Top Rated
Asp.Net Top Rated
Java Top Rated
Python Top Rated
PHP Top Rated
Perl Top Rated
Javascript Top Rated
Ajax Top Rated
CSS Top Rated
Open Source Top Rated
SQL Top Rated
Databases Top Rated
Oracle Top Rated
MySql Top Rated
Sql Server Top Rated
IIS Top Rated
Apache Top Rated
Linux Top Rated
Windows Server Top Rated
Project Management Top Rated
HTML Top Rated
UML Top Rated
IT Certifications Top Rated
Cisco Certifications Top Rated
MCSE Top Rated
MCSD Top Rated
Cooking Top Rated
Italian Cooking Top Rated
Vegetarian Cooking Top Rated
Wine Top Rated
Engineering Top Rated
Entertainment Top Rated
Health Top Rated
Nutrition Top Rated
Dieting Top Rated
Sex Top Rated
History Top Rated
Military History Top Rated
British History Top Rated
Middle East History Top Rated
Land Battles Top Rated
Naval Warfare Top Rated
Air Warfare Top Rated
9/11 Top Rated
Terrorism Top Rated
Home Top Rated
Mortgage\Home Equity Loan Top Rated
Cars Top Rated
Car Buying Top Rated
Sports Cars Top Rated
Cat Top Rated
Humor Top Rated
Horror Top Rated
Law Top Rated
IP Law Top Rated
Legal History Top Rated
Fiction Top Rated
Oprah's Book Club Top Rated
Medicine Top Rated
Cancer Top Rated
Stroke Top Rated
Heart Disease Top Rated
Fertility Top Rated
Diabetes Top Rated
Pharmacology Top Rated
Back Problems Top Rated
Menopause Top Rated
Thyroid Top Rated
Pain Top Rated
Organic Chemistry Top Rated
Immune System Top Rated
Mystery Top Rated
Nonfiction Top Rated
Outdoors Top Rated
Running Top Rated
Radio Control Models Top Rated
Guns Top Rated
Parenting Top Rated
Divorce Top Rated
Professional Top Rated
Reference Top Rated
Religion Top Rated
Romance Top Rated
Science Top Rated
Physics Top Rated
Chemistry Top Rated
Astronomy Top Rated
Psychology Top Rated
Science Fiction Top Rated
Sports Top Rated
Teens Top Rated
Travel Top Rated
USA Top Rated
Europe Top Rated
France Top Rated
Italy Top Rated
England Top Rated
China Top Rated
All Books Arts Biography Click Here For An A-Z Index Of All 213 Best-Seller Subjects Business Children's Comics
Computers Cooking Engineering Entertainment Health History Home Horror Humor Law Fiction Medicine Mystery
Nonfiction Outdoors Parenting Professional Reference Religion Romance Science Sci-Fi Sports Teens Travel
In Association with Amazon.com

Cache miss
(not cached)