<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Case study: FIXML to Java, C# and C++</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>K. Lano</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>S. Yassipour-Tehrani</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>K. Maroukian</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dept. of Informatics, King's College London</institution>
          ,
          <addr-line>Strand, London</addr-line>
          ,
          <country country="UK">UK</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2003</year>
      </pub-date>
      <abstract>
        <p>This case study is a transformation from financial transaction data expressed in FIXML XML format, into class definitions in Java, C# and C++. It is based on an industrial application of MDD in finance, and aims to support rapid upgrading of user software when new or extended FIXML definitions become available. The transformation involves text-to-model, model-to-model and model-to-text subtransformations. Financial transactions can be electronically expressed using formats such as the FIX (Financial Information eXchange) format. New custom variants/extensions of such message formats can be introduced, which leads to problems in the maintainance of end-user software: the user software, written in various programming languages, which generates and processes financial transaction messages will need to be updated to the latest version of the format each time it changes. In [2] the authors proposed to address this problem by automatically synthesising program code representing the transaction messages from a single XML definition of the message format, so that users would always have the latest code definitions available. For this case study we will restrict attention to generating Java, C# and C++ class declarations from messages in FIXML 4.4 format, as defined at http://fixwiki.org/fixwiki/FPL:FIXML Syntax, and http://www.fixtradingcommunity.org. The solution transformation should take as input a text file of a message in XML FIXML 4.4 Schema format, and produce as output corresponding Java, C# and C++ text files representing this data.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
      <p>Solutions to the case study can devise their own metamodel(s) for the abstract syntax of the target
programming languages. Solutions may use external software for the XML parsing step and/or for the
code generation step, and may use different transformation languages for the 3 subtransformations.</p>
      <p>The informal transformation rules mapping from XML to a programming language (eg., Java) are
the following, in terms of concrete syntax:
(Rule 1): An XML tag is translated to a Java Class:
&lt;tag1 .... /&gt;
becomes
class tag1 { .... }
(Rule 2): XML attributes are mapped to Java attributes:
&lt;tag1 att1="val1" att2="val2" /&gt;
becomes
etc.
&lt;tag1 .... &gt;
&lt;tag2 ... /&gt;
&lt;tag3 ... /&gt;
&lt;/tag1&gt;
becomes
class tag1
{ String att1 = "val1"; String att2 = "val2"; }
(Rule 3): Nested XML tags become Java member objects:
class tag1
{ ....</p>
      <p>tag2 tag2_object = new tag2();
tag3 tag3_object = new tag3();
}
This rule should also take that case into account where multiple subnodes of the same node with
the same tag name exist: these subnodes may be represented by distinct attributes with the same
tag object type, initialised by specific constructors, or by an array/list of such objects.
In order to improve the utility of the generated program code, constructors should be provided for the
generated classes, which permit initialising of all their features. A default no-argument constructor
should also be provided.
2.1</p>
      <sec id="sec-1-1">
        <title>Test cases</title>
        <p>The solutions should be tested on the test cases test1.xml to test8.xml provided. Test cases 1 to
4 represent typical FIXML messages. Tests 5 and 6 are tests of solution efficiency on large messages.
Tests 7 and 8 are examples of invalid XML files which should be rejected by the transformation.</p>
        <p>The first test is a simple example of an Order message:
&lt;?xml version="1.0" encoding="ASCII"?&gt;
&lt;FIXML&gt;
&lt;Order ClOrdID="123456" Side="2"</p>
        <p>TransactTm="2001-09-11T09:30:47-05:00" OrdTyp="2"</p>
        <p>Px="93.25" Acct="26522154"&gt;
&lt;Hdr Snt="2001-09-11T09:30:47-05:00"</p>
        <p>PosDup="N" PosRsnd="N" SeqNum="521"&gt;
&lt;Sndr ID="AFUNDMGR"/&gt;
&lt;Tgt ID="ABROKER"/&gt;
&lt;/Hdr&gt;
&lt;Instrmt Sym="IBM" ID="459200101" IDSrc="1"/&gt;
&lt;OrdQty Qty="1000"/&gt;
&lt;/Order&gt;
&lt;/FIXML&gt;</p>
        <p>The second test is a more complex example of a Position Report message, which features multiple
subnodes with the same tagname:
class Qty
{ String Type = "SOD";</p>
        <p>String Long = "35";
String Short = "0";
...
}
&lt;Instrmt Sym="AOL" ID="KW" IDSrc="J" CFI="OCASPS" MMY="20031122"</p>
        <p>Mat="2003-11-22T00:00:00" Strk="47.50" StrkCcy="USD" Mult="100"/&gt;
If there are multiple nodes with the same tag, the class representing the tag will have the union of the
instance variables derived from the attributes and subnodes of all these occurrences. For example, Qty is
represented by</p>
        <p>Other sample FIXML messages can be found at http://fixwiki.org/fixwiki/FPL:FIXML Syntax.</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>3 Extensions</title>
      <p>The following enhancements of the transformation can be considered.</p>
      <sec id="sec-2-1">
        <title>3.1 Selection of appropriate data types</title>
        <p>In cases where attribute values are integers or doubles, the attributes should be mapped to programming
language instance variables of these types. For example, Strk="47.50" would be mapped to double
Strk = 47.50;.
3.2</p>
      </sec>
      <sec id="sec-2-2">
        <title>Extension to additional languages</title>
        <p>Identify how the transformation can be extended to generate C code instead of object-oriented language
code. Implement a version of the transformation which generates C code declarations.
3.3</p>
      </sec>
      <sec id="sec-2-3">
        <title>Generic transformation</title>
        <p>The transformation could also be extended to define a generic transformation which maps the FIXMLSchema
definition (http://fixwiki.org/fixwiki/FPL:FIXML Syntax) or DTD (http://www.fixtradingcommunity.org/pg/
structure/tech-specs/fix-version/44) into Java, C# and C++. This mapping would support the
comprehensive representation of arbitrary valid FIXML messages as program objects.
A</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Evaluation criteria</title>
      <p>
        Relevant characteristics and subcharacteristics for evaluation of model transformations can be selected from the
ISO/IEC 9126-1 framework [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. These characteristics and subcharacteristics can then be further decomposed into
measurable attributes. Table 1 summarizes the chosen characteristics, subcharacteristics and their corresponding
measurable attributes. One attribute may be related to more than one quality factor.
      </p>
      <p>Fault tolerance
Changeability
The following are the specific measures which should be evaluated for each solution to this case study:
Complexity: sum of number of operator occurrences and feature and entity type name references in the
specification expressions
Accuracy: that the resulting programs are valid in their languages (syntactic correctness), and that they
correctly represent the source XML data structure and elements (semantic preservation). In particular, the
programming language constraint that distinct instance variables of the same class must have distinct names
must be ensured (syntactic correctness).</p>
      <p>Development effort: developer time in person-hours spent in writing and debugging the specification
Fault tolerance: High if transformation is able to detect invalid input XML and produce accurate error
messages; Medium if erroneous files produce a failed execution with an indication that some error occurred;
Low if such files are processed and output produced without warnings being issued
Execution time: milliseconds for execution of each of the three stages
Modularity: 1 dr where d is the number of dependencies between rules (implicit or explicit calls, ordering
dependencies, inheritance or other forms of control or data dependence) and r is the number of rules.</p>
      <p>Abstraction level is classified as High for primarily declarative solutions, Medium for declarative-imperative
solutions, and Low for primarily imperative solutions.</p>
      <p>Execution time of the subtransformation implementations includes the loading of models and printing of output
code from the transformation tool(s).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Botella</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          , Burgue´s,
          <string-name>
            <given-names>X.</given-names>
            ,
            <surname>Carvallo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. P.</given-names>
            ,
            <surname>Franch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            ,
            <surname>Grau</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            ,
            <surname>Marco</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Quer</surname>
          </string-name>
          ,
          <string-name>
            <surname>C.</surname>
          </string-name>
          ,
          <article-title>ISO/IEC 9126 in practice: what do we need to know?</article-title>
          ,
          <source>Software Measurement European Forum (SMEF</source>
          <year>2004</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>M. B.</given-names>
            <surname>Nakicenovic</surname>
          </string-name>
          ,
          <article-title>An Agile Driven Architecture Modernization to a Model-Driven Development Solution</article-title>
          ,
          <source>International Journal on Advances in Software</source>
          , vol
          <volume>5</volume>
          ,
          <source>nos. 3</source>
          ,
          <issue>4</issue>
          ,
          <year>2012</year>
          , pp.
          <fpage>308</fpage>
          -
          <lpage>322</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>