Search⌘ K
AI Features

Introduction to the Unidirectional Association Application

Explore how to build unidirectional functional associations between JavaScript classes, enabling management of related object data in front-end apps. Understand how to derive and code plain JS models with single-valued reference properties, and integrate model, view, and controller coding for a functional application.

We'll cover the following...

The three example applications that we’ve have in previous parts of this course (the MinimalApp, the ValidationApp, and the EnumerationApp) have been limited to managing the data of only one object type. A real application, however, has to manage the data of several object types, which are typically related to each other in various ways. For example, there may be associations and subtype (inheritance) relationships between object types. Handling associations and subtype relationships are advanced issues in software application engineering. They aren’t often discussed at length in textbooks and aren’t well supported by application development frameworks.

A unidirectional functional association is either one-to-one or many-to-one. In both cases, associations are represented, or implemented, with the help of a single-valued reference property.

What we’ll cover

In this chapter, we’ll look at the following

  1. How to derive a plain JS class model from an OO class model using single-valued reference properties representing unidirectional functional associations.
  2. How to code the JS class model in the form of plain JS model classes.
  3. How to write the view and controller code based on the model code.

Before we show how to derive a plain JS class model and code it in JavaScript, we first introduce a few new elements of the JS language that we’ll use throughout this course.