4.11 Unbounded Result Sets
Design with skepticism, and you will achieve resilience. Ask, “What can system X do to hurt me?” and then design a way to dodge, duck, dip, dive, and dodge whatever wrench your supposed ally throws.
If your application is like most, it probably treats its database server with far too much trust. I’m going to try to convince you that a healthy dose of skepticism will help your application dodge a bullet or two.
A common structure in the code goes like this: send a query to the database, and then loop over the result set, processing each row. Often, processing a row means adding a new data object to a collection. What ...