17.9. Connecting the UI Layer to the Domain Layer

As has been briefly discussed, applications are organized into logical layers that separate the major concerns of the application, such as the UI layer (for UI concerns) and a “domain” layer (for domain logic concerns).

Common designs by which objects in the UI layer obtain visibility to objects in the domain layer include the following:

  • An initializing routine (for example, a Java main method) creates both a UI and a domain object, and passes the domain object to the UI.

  • A UI object retrieves the domain object from a well-known source, such as a factory object that is responsible for creating domain objects.

The sample code shown before is an example of the first approach:

						public class Main

Get Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.