Chapter 8. Object Lifetime
Menu
- Managing DEPENDENCY LIFETIME
- Disposable DEPENDENCIES
- SINGLETON
- TRANSIENT
- PER GRAPH
- WEB REQUEST CONTEXT
- POOLED
The passing of time has a profound effect on most foods and drinks, but the consequences vary. Personally, I find 12-month-old Gruyère much more interesting than 6-month-old Gruyère, but I prefer my asparagus much fresher than either of those. In many cases, it’s easy to assess the proper age of an item; but in certain cases, doing so becomes very complex. This is most notable when it comes to wine (see figure 8.1).
Figure 8.1. Wine, cheese, and asparagus. Although the combination may be a bit off, their age greatly affects their overall qualities.

Wines tend to get better with age—until they suddenly become too old and lose most of their flavor. This depends on a lot of factors, including the origin and vintage of the wine. Although wines interest me, I don’t expect to ever be able to predict when a wine will peak. For that, I rely on experts: books at home and sommeliers at restaurants. They understand wines better than I do because it’s their specialty, so whenever I trust them I happily let them take control.