Composer
Purpose
The box a member writes into — the words as they stand before they are a message. A composer is
allowed to hold anything, including nothing: a person opens an empty composer, types, deletes,
hesitates. That is exactly why it is its own value and not a Writing — the comms domain's
Writing is a message's readable text and holds itself to a message's standard, while a composer
holds text that may never be sent at all. The judgement of whether the words became sendable is
the composer's own: its writing refuses a blank, so the send button asks the box and never
re-reads the text itself.
Attributes
- text: is
Textthat the member has typed so far — possibly empty, possibly only whitespace
Invariants
(none — an open composer may hold anything, including nothing)
Operations
writing
Hands over the text as it stands, ready to become a Writing, refusing text that holds no words
beyond whitespace — a blank line is not a message, and nothing blank ever leaves the device,
because the box itself declines to hand it over.
Result: the sendable text as Text; fails when the text holds no words beyond whitespace
Scenarios
A blank composer hands over no writing
Given: text " " When: writing is asked for Then: the request fails because the text holds no words beyond whitespace
An empty composer hands over no writing
Given: text "" When: writing is asked for Then: the request fails because the text holds no words beyond whitespace
Typed words become the writing
Given: text "The hearing moved to Thursday." When: writing is asked for Then: the text handed over is "The hearing moved to Thursday."
An empty composer is a composer
Given: text "" When: a Composer is created Then: it is accepted, holding no words yet
A composer holds what was typed
Given: text "The hearing moved to Thursday." When: a Composer is created Then: it is accepted and reads back holding "The hearing moved to Thursday."