Yttrium Insights Part 2: In and Out - The System Builder
A recent addition to the Yttrium framework is the system builder. The idea is to define a "command based" description of a math system (MathSystem class) to separate the construction of such a system from the system itself. In incorporates ideas from the builder design pattern. The central point is the ISystemBuilder interface, defining the description mentioned above.
There are always to parts, communication by the said interface: a director or reader, and a builder or writer. The interesting point is that both parts are interchangeable: any reader works with any writer and vice versa.
Predefined Writers
- SystemWriter: constructs a complete math system.
- XmlSystemWriter: describes a complete system in Xml.
- ExpressionWriter: experimental, describes a system in the Yttrium expression language supported by the parsing infrastructure (kinf of a mixture between the Maple language and VHDL).
Predefined Readers
- SystemReader: describes a complete math system.
- XmlSystemReader: describes a complete system based on Xml.
Because the parts may be combined at will, it opens several useful operations:
Cloning a MathSystem
Cloning a system is as simple as combining a SystemReader with a SystemWriter:
1: 2: 3: 4: |
|
Shortcut:
1:
|
|
Serialize a MathSystem to Xml
Just combine the SystemReader with an XmlWriter:
1: 2: 3: 4: |
|
Shortcut:
1:
|
|
Deserialize a MathSystem from Xml
1: 2: 3: 4: |
|
Shortcut:
1:
|
|