Interfaces

Last updated 18 days ago

'Interfaces' is the folder where we store all of our "workspace interfaces". "Workspace interfaces" are how we guarantee that building blocks don't access each others implementations.

‚Äč

We're introducing a new interface concept here, but please don't panic! We promise that the reason for having two kinds of interfaces will soon become clear.

Each component has two interfaces:

  1. The component interface (which we've already covered) lives inside the component, and each of its functions delegate through to the component's implementation.

  2. The workspace interface lives in the interfaces folder at the top level of workspace, and each of its functions is empty.

We use workspace interfaces to guarantee implementation isolation between components. We check that all components compile against the workspace interfaces, which guarantees that they don't rely on any code that lives inside another component's implementation.

The RealWorld interfaces "drawer" contains eight 'workspace interfaces'
'Workspace interfaces' have flat tops, i.e. no dependencies
The yellow hole represents the 'login!' function, which is empty

Keeping all the workspace interfaces in one place has the added benefit of giving us one place to look to see all the functionality offered by all of our components.