Skip to content

Instantly share code, notes, and snippets.

@medelman17
Last active October 28, 2019 00:36
Show Gist options
  • Save medelman17/c31f78294ad338939709c1a86c56ce30 to your computer and use it in GitHub Desktop.
Save medelman17/c31f78294ad338939709c1a86c56ce30 to your computer and use it in GitHub Desktop.
Abstract/Problem Statement re Building Context-Aware React Native Applications at Scale

Building Context-Aware React Native Applications at Scale

In 2001, Dey et al. described a hypothetical "conference assistant" application that was designed to enhance the individual experiences of conference attendees.[^Dey, Anind & Abowd, Gregory & Salber, Daniel. (2001). A Conceptual Framework and a Toolkit for Supporting the Rapid Prototyping of Context-Aware Applications. Human-Computer Interaction. 16. 10.1207/S15327051HCI16234_02.] The app would run on a "handheld device" that each attendee would be given upon arrival at the conference. Thereafter, the app would offer thoughtful guidance and assistance as each attendee progressed throughout the conference. For example, when an attendee would enter a presentation room, the app would display information about the session that was about to begin. This would include "information on the presenter, relevant URLs and the proceedings, page numbers of the papers being presented[,]" etc. It would also, inter alia, show "a thumbnail of the current slide and offer[] note-taking abilities."[^*Id.* at 7-8.]

The above hypothetical arose out of a "scaled-down version" that the authors had recently implemented. According to the authors, prior to their work, "there ha[d] not been a context-aware application that approache[d] this [level of] complexity, in terms of the variety of context used and the ways in which it is used."[^*Id.*] Fast-forward nearly two decades later and a "themeable, customizable, full stack and cross-platform mobile" version of the above app is available for free on GitHub and deployable "in minutes."[^Dabit, Nader (2019), Introducing Conference App in a Box. dev.to., available at https://dev.to/dabit3/introducing-conference-app-in-a-box-kgj] Moreover, present-day conference attendees neither need nor want another device to lug around. Indeed, the devices that attendees bring with them (and everywhere else) offer access to a myriad and diverse assortment of context-aware application program interfaces. Suffice it to say: technology has come a long way.

But, while advances in technology have since mitigated many of the challenges faced by Dey et al. surrounding the acquisition of context--that is, "any information the can be used to characterize the situation of entities (i.e., whether a person, place, or object) that are considered relevant to the interaction between a user and an application, including the user and the application themselves."[^Dey (2001), *supra*, at 11.]--challenges related to the use of such data have largely remained the same, if not become more complex. Indeed, as it was in 2001, (1) there remains a dearth of guiding principles to support good software engineering practices related to use of contextual data; (2) there is a lack of effective abstraction with which developers can think about context; and (3) "context-sensing" is often very distributed, leading to complex distributed designs. None of that is ideal in a world in which the demand for highly-personalized, optimized user experiences grows exponentially. In other words, a world in which context is king.

Here, we outline how we sought to remedy many of the above challenges--all of which are made worse when experienced as part of a large team--in a large-scale, e-commerce application built with react-native. To do so, we shamelessly and repeatedly leverage React's, aptly named, Context API,[^React Documentation (2019; v16.10.2), Context, available at https://reactjs.org/docs/context.html] using a Hooks-based pattern that was recently popularized by Kent C. Dodds.[^Dodds, Kent C. (2019), How to use React Context effectively, available at https://kentcdodds.com/blog/how-to-use-react-context-effectively.] In our experience, the approach has proven efficacious; easy to understand, implement, and maintain; and meaningfully composable, providing the flexibility and extensibility that we need to meet the demands of today's discerning users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment