Physical Space

Table of Contents

The physical domain is the subset of MASD's problem domain comprised of physical artefacts: the files and directories that live on a filesystem. It is the concrete realisation of the logical space — every physical artefact is a projection of a logical entity through a facet.

masd_file_folder.png

Figure 1: Figure 1 (Dogen): key entities in the physical domain. Source: Domain Architecture.

The two primitive artefacts are:

For the formal treatment see Domain Architecture and Models and Transformations.

File morphology

A file artefact is segmented into three parts:

  • Prologue — boilerplate: decoration (editor modeline, copyright, licence) and any header guard.
  • Body — the core content, sensitive to structural variability: namespace, type documentation, the type definition itself.
  • Epilogue — closing segments.

Files are further classified along two axes. By origin: exogenous files are created externally and have irregular inclusion paths, whereas endogenous files are generated by MASD and have regular ones. By mode of production: manual (handwritten), automated (generated), or partially automated (a merge of the two).

Files relate to one another: "a file A₁ is related to another file A₂ if the content of A₁ has a functional dependency on A₂" — that is, A₁ references A₂. A relation is constant if it always holds (insensitive to variability) or variable if it depends on structural or non-structural variability.

The folder taxonomy

Folder artefacts form a containment taxonomy. From the outside in:

  • A component is divided into one or more parts; a component with a single part may omit the part folder.
  • A part is a container grouping related file artefacts — for C++, the canonical parts are include (public headers) and src (implementation).
  • A facet is a container for a set of related file artefacts that all belong to the same technical space; it is the mechanism that implements the composition of trivial structural functions.
  • A module is the physical representation of the programming-language concept of package or namespace.

masd_part_taxonomy.png

Figure 2: Figure 15 (Dogen): a simplified part taxonomy. Source: Domain Architecture.

The physical address

Every artefact occupies a point in physical space, written as a four-segment address:

[technical space].[part].[facet].[archetype]

For example:

  • cpp.include.types.class_header — a C++ class header.
  • cpp.src.types.class_implementation — its implementation.
  • csharp.main.types.class — a C# class definition.

A prefix of an address denotes a region: cpp is all C++ content; cpp.include is everything under the C++ include part. The address of an artefact is determined by its containment in the PMM (TS → part → facet → archetype).

masd_points_in_all_spaces.png

Figure 3: Figure 33 (Dogen): notation for points in physical and logical space. Source: Domain Architecture.

Archetype versus artefact

These two are easily confused:

  • An archetype is a generating function and the abstract template for a class of artefacts — a region of physical space. Each archetype produces exactly one output file per logical entity, and is parameterised by the logical model (entity name, fields, namespace, containment).
  • An artefact is an instance: a concrete, classified file produced by an archetype for a specific entity.

The Physical Metamodel (PMM)

The Physical Metamodel encodes the full TS→Part→Facet→Archetype geometry as a queryable structure. The generator consults it at runtime to answer questions such as "which facets are defined for the C++ TS?" or "how many archetypes does the types facet contain?".

The PMM sits in a four-level metamodelling hierarchy:

Level Content
M3 Metametamodel — the archetypes (file/folder archetypes)
M2 The PMM — instantiates archetypes into a model
M1 The physical model — artefact instances
M0 The filesystem — actual files and directories

Projections into physical space

A projection transforms a logical entity into its physical artefacts. The transformation is ultimately a Model-to-Text (M2T) operation: the logical model is the input; the rendered archetypes are the output. The same logical entity projects into multiple technical spaces and into multiple facets within each, so a single change to the logical entity propagates across all its artefacts on regeneration. See Logical Space for the originating side of the projection.

See also

  • MASD — methodology overview and the conceptual model.
  • Logical Space — the meta-model that physical artefacts are projected from.
  • Technical Space — the outermost grouping in physical space.
  • Facet — the partitioning of artefacts by role; the unit of composition.
  • Variability — how facet and archetype activation is configured.
  • Applied MASD — how one product instantiates this physical space.

Emacs 29.1 (Org mode 9.6.6)