Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common/Interface/Components.md

184 lines
10 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/Interface/Components/IAssemblyView.cs
- Common/DTS.Common/Interface/Components/IAssemblyListView.cs
- Common/DTS.Common/Interface/Components/ITileView.cs
- Common/DTS.Common/Interface/Components/IGroupView.cs
- Common/DTS.Common/Interface/Components/ITileListView.cs
- Common/DTS.Common/Interface/Components/IGroupListView.cs
- Common/DTS.Common/Interface/Components/IAssemblyViewModel.cs
- Common/DTS.Common/Interface/Components/IAssemblyListViewModel.cs
- Common/DTS.Common/Interface/Components/ITileViewModel.cs
- Common/DTS.Common/Interface/Components/IGroupViewModel.cs
- Common/DTS.Common/Interface/Components/ITileListViewModel.cs
- Common/DTS.Common/Interface/Components/IGroupListViewModel.cs
generated_at: "2026-04-16T03:01:46.484728+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e01b1b94fbb8ea7a"
---
# Components
## Documentation: View and ViewModel Interfaces for Assembly/Tile/Group UI Components
---
### 1. Purpose
This module defines a set of interfaces that establish the contract between UI views and their corresponding view models for hierarchical presentation of assembly, tile, and group data. It supports two distinct UI presentation patterns—*single-item views* (e.g., `IAssemblyView`, `ITileView`, `IGroupView`) and *list-of-items views* (e.g., `IAssemblyListView`, `ITileListView`, `IGroupListView`)—each paired with a matching view model (`*ViewModel`). These interfaces are part of a layered architecture where views are UI-layer abstractions (likely bound to XAML or similar), and view models mediate data and commands. The module enables consistent composition of UI hierarchies: a *list view* contains a list of *item views*, each backed by its own *item view model*.
---
### 2. Public Interface
#### View Interfaces (UI Layer Abstractions)
- **`IAssemblyView`**
*Namespace:* `DTS.Common.Interface`
*Inherits:* `IBaseView`
Represents a single assembly UI view (e.g., a control or panel displaying one assembly).
- **`IAssemblyListView`**
*Namespace:* `DTS.Common.Interface`
*Inherits:* `IBaseView`
Represents a container view for a list of `IAssemblyView` instances (e.g., a scrollable list of assembly panels).
- **`ITileView`**
*Namespace:* `DataPro.Common.Interface`
*Inherits:* `IBaseView`
Represents a single tile UI view (e.g., a card or grid cell for a tile).
- **`IGroupView`**
*Namespace:* `DataPro.Common.Interface`
*Inherits:* `IBaseView`
Represents a single group UI view (e.g., a section header or container for grouped items).
- **`ITileListView`**
*Namespace:* `DataPro.Common.Interface`
*Inherits:* `IBaseView`
Represents a container view for a list of `ITileView` instances.
- **`IGroupListView`**
*Namespace:* `DataPro.Common.Interface`
*Inherits:* `IBaseView`
Represents a container view for a list of `IGroupView` instances.
#### ViewModel Interfaces (Data/Logic Layer Abstractions)
- **`IAssemblyViewModel`**
*Namespace:* `DTS.Common.Interface`
*Inherits:* `IBaseViewModel`
- `IAssemblyView View { get; set; }` The view instance bound to this model.
- `string GroupName { get; set; }` The group name associated with this assembly.
- `List<AssemblyNameImage> AssemblyList { get; set; }` List of assemblies (type `AssemblyNameImage` defined elsewhere) to display.
*Behavior:* Manages data for a single assembly view.
- **`IAssemblyListViewModel`**
*Namespace:* `DTS.Common.Interface`
*Inherits:* `IBaseViewModel`
- `IMainViewModel Parent { get; set; }` Reference to the top-level view model.
- `IAssemblyListView View { get; set; }` The list view instance.
- `List<IAssemblyView> GroupList { get; set; }` List of *views* (not view models) representing individual assembly groups.
*Behavior:* Manages a list of assembly views; note that `GroupList` holds *views*, not `IAssemblyViewModel`s.
- **`ITileViewModel`**
*Namespace:* `DataPro.Common.Interface`
*Inherits:* `IBaseViewModel`
- `ITileView View { get; set; }`
- `string GroupName { get; set; }`
- `List<AssemblyNameImage> AssemblyList { get; set; }`
*Behavior:* Manages data for a single tile view.
- **`IGroupViewModel`**
*Namespace:* `DataPro.Common.Interface`
*Inherits:* `IBaseViewModel`
- `IGroupView View { get; set; }`
- `string GroupName { get; set; }`
- `List<AssemblyNameImage> AssemblyList { get; set; }`
*Behavior:* Manages data for a single group view.
- **`ITileListViewModel`**
*Namespace:* `DataPro.Common.Interface`
*Inherits:* `IBaseViewModel`
- `IMainViewModel Parent { get; set; }`
- `ITileListView View { get; set; }`
- `List<ITileView> GroupList { get; set; }`
*Behavior:* Manages a list of tile views; `GroupList` holds *views*, not `ITileViewModel`s.
- **`IGroupListViewModel`**
*Namespace:* `DataPro.Common.Interface`
*Inherits:* `IBaseViewModel`
- `IMainViewModel Parent { get; set; }`
- `IGroupListView View { get; set; }`
- `List<IGroupView> GroupList { get; set; }`
*Behavior:* Manages a list of group views; `GroupList` holds *views*, not `IGroupViewModel`s.
> **Note on naming consistency**:
> - `DTS.Common.Interface` namespace is used for *assembly*-centric interfaces.
> - `DataPro.Common.Interface` namespace is used for *tile* and *group*-centric interfaces.
> This suggests a historical split between two subsystems (DTS and DataPro) that share similar UI patterns.
---
### 3. Invariants
- **ViewViewModel Pairing**: Each `*ViewModel` interface declares a `View` property typed to its corresponding `*View` interface (e.g., `IAssemblyViewModel``IAssemblyView`). This enforces a 1:1 binding contract.
- **Hierarchical Structure**:
- `*ListViewModel` interfaces (`IAssemblyListViewModel`, `ITileListViewModel`, `IGroupListViewModel`) hold a `List<IView>` (not `IViewModel`) in their `GroupList` property.
- This implies that list view models do *not* directly manage child view models—only the *views* they contain.
- **GroupName Semantics**: All item-level view models (`IAssemblyViewModel`, `ITileViewModel`, `IGroupViewModel`) expose a `GroupName` property, suggesting that each item belongs to a named group.
- **AssemblyList Consistency**: All item-level view models use `List<AssemblyNameImage>` for `AssemblyList`, indicating uniform data structure for underlying content.
- **Parent Reference**: All list view models expose a `Parent` property of type `IMainViewModel`, enforcing a tree structure rooted at a main view model.
---
### 4. Dependencies
#### Internal Dependencies (from source):
- **Base Interfaces**:
- All view interfaces inherit from `IBaseView`.
- All view model interfaces inherit from `IBaseViewModel`.
*(Exact definitions of `IBaseView` and `IBaseViewModel` are not provided here but are assumed to be in `DTS.Common.Base` or `DataPro.Common.Base`.)*
- **Data Types**:
- `AssemblyNameImage` (used in `AssemblyList`) is referenced but not defined in these files. Its definition must exist elsewhere (likely in `DTS.Common.Base` or `DataPro.Common.Base`).
- **.NET Framework Types**:
- `System.Collections.Generic.List<T>`
- `System.Collections.ObjectModel.Collection<T>` (imported but unused in these files)
- `System.Reflection.Assembly` (imported but unused in these files)
#### External Dependencies:
- **Consumers**:
- UI rendering layers (e.g., WPF/XAML views) must implement `*View` interfaces.
- View model implementations (e.g., `AssemblyViewModel`, `TileListViewModel`) must implement `*ViewModel` interfaces.
- `IMainViewModel` must be defined elsewhere and is required by all list view models.
- **Namespaces**:
- `DTS.Common.Interface` and `DataPro.Common.Interface` are used for view/view model interfaces.
- `DTS.Common.Base` and `DataPro.Common.Base` are used for base interfaces.
---
### 5. Gotchas
- **Inconsistent Namespace Usage**:
Assembly-related interfaces (`IAssemblyView`, `IAssemblyListView`, `IAssemblyViewModel`, `IAssemblyListViewModel`) reside in `DTS.Common.Interface`, while tile/group equivalents (`ITile*`, `IGroup*`) are in `DataPro.Common.Interface`. This may reflect legacy code splitting and could cause confusion during refactoring or cross-feature development.
- **`GroupList` Holds Views, Not View Models**:
In `IAssemblyListViewModel`, `ITileListViewModel`, and `IGroupListViewModel`, the `GroupList` property is typed as `List<IView>`, *not* `List<IViewModel>`. This breaks typical MVVM patterns where list view models manage child view models. Developers may mistakenly expect to access child view models via this list.
- **Unused Imports**:
`System.Collections.ObjectModel` and `System.Reflection` are imported in several `*ViewModel` files but never used. This may indicate incomplete cleanup or future extensibility (e.g., planned use of `ObservableCollection`), but currently serves no purpose.
- **Ambiguity of `GroupName`**:
While `GroupName` is present in all item view models, its semantics (e.g., is it a display name? a grouping key? a category?) are not defined here. Its value may be derived from the `AssemblyList` or external metadata.
- **No Method Signatures**:
All interfaces are property-only. No commands or methods are declared, implying behavior is either in `IBaseViewModel` or handled externally (e.g., via event handlers or command binding in the view layer). This may limit testability or composability.
- **No Inheritance Between View Models**:
Despite structural similarity, there is no shared base interface for item view models (e.g., `IAssemblyViewModel`, `ITileViewModel`, `IGroupViewModel` are independent). This duplication may increase maintenance burden.
- **No Validation or State Guarantees**:
The interfaces do not specify constraints (e.g., `AssemblyList` must be non-null, `GroupName` must be non-empty). Implementers must infer or define such rules elsewhere.
> **None identified from source alone** for *behavioral quirks* or *historical tech debt*, but the above structural inconsistencies are notable.