Viewable Data Wrapper

**Problem:** When you explore data with a platform such as Glamorous Toolkit, the views you obtain reflect the low-level data structures used to represent the data, not the underlying domain concepts. How can we add appropriate high-level views to the data?

**Forces:**

When we explore data, we represent them using suitable low-level data structures.

Data structures (lists, dictionaries) reflect the representation of data, not their interpretation.

To analyze and explore data, we need higher-level views that reflect our understanding of the data.

**Solution:**

Wrap each kind of data in a dedicated class reflecting the problem domain. As you explore the data, introduce custom views to the domain class that reflect answers to questions you ask about the data.

**Steps:**

Extract the data of interest. This might be data sitting in your file system (for example, a CSV file), or data retrieved from a website.

A classical example can be seen in Working with a REST API: the GitHub case study.

We obtain a Dictionary representation of JSON data about the feenk GitHub organization:

url := 'https://api.github.com/orgs/feenkcom'. json := ZnClient new get: url. dictionary := STON fromString: json.

If we explore this object, we just see the keys and values of the raw downloaded data. From this view, of course we can explore the data by navigating the Dictionary views, or by programatically exploring other paths using the Inspector Playground, but we cannot add or tailor views to specifically support the GitHub Organization domain.

[…]

**Related patterns:**

**Known Uses:**