Design Philosophy¶
One of the main goals of developing MTPPy2.0 is that it shall serve as a comprehensible reference implementation of the MTP 2.0 Specification. This primary objective directly influences the repository's structure, naming conventions, and overall architectural approach.
Structural Alignment with Specification¶
The guiding principle of the package design is to
- maintain a close link between the implementation and the MTP 2.0 Specification, and
- separate the different aspects as good as possible even if the runtime performance might be negatively affected
This is achieved through a structural mapping between package design and specification organization. Consequently, the directory structure includes artifacts (such as partN) that correspond directly to the specification's structure.
Naming and Data Representation¶
To ensure consistency and ease of referencing to the MTP 2.0 Specification the project implements the following directives:
-
Class Names: Are directly derived from the specification.
-
Data Structures: Internal data is organized using flat dictionaries (
dict), with key names following the specification's terminology as closely as possible.
Software Engineering Principles¶
- Extensibility: The project utilizes
abc.ABC(Abstract Base Classes) to define clear interfaces. This ensures the class hierarchy remains extensible and allows for various implementations of the same interface. - DRY (Don't Repeat Yourself): The project implements major aspects of the DRY principle with the goal of reducing the repetition of information and minimizing maintenance overhead. For instance, we try to use string constants and Enum classes where ever possible.
- Separation of Concerns: A clear distinction is maintained between domain-specific logic (located in
src/mtppy) and general-purpose utility helpers (located in../src/utils).