Chapter 7. Data modeling
This chapter covers
- Storing values with associated keys by using dictionaries
- Building interactive trees by using recursive custom types
- Using intermediate representations to decode JSON incrementally
- Decoding recursive data structures with recursive JSON decoders
Our manager is back from vacation and eager to tell the team about a poolside revelation for a new Photo Groove feature: Photo Folders. (The original name was “Photo Pholders” but Marketing said no.) As our users’ photo collections grow, they’ve been asking for ways to organize them. Folders are a tried-and-true way to offer exactly that!
To build this feature, we’ll introduce a second page to Photo Groove. It will let users navigate through a folder hierarchy, with each folder potentially holding several photos as well as several other folders.
This Photo Folders page will also showcase a new feature one of our coworkers built: Related Photos. This feature automatically analyzes a user’s photos, detects which ones are related to which others, and tags those photos as related on the server. The Photo Folders page will be the first to display these new Related Photos relationships. When the user selects a photo in a particular folder, we’ll show them a larger version of the photo, as well as thumbnails of its related photos.