@misc{11554, author = {J. Glattetre and Marek Vok{\'a}c}, title = {Generating Service Descriptions and Code From Reusable Models}, abstract = {Data models have a longer lifetime than the storage platform or technology they are implemented on at any given time. The models tend to change relatively slowly, and are usually described by some form of platform-in{\l}notde{\l}notpendent dictionary, though this may be in a proprietary form. It is then desirable to generate platform- and technology specific data definitions and persistence layers from such a description, as technology changes over time. We have implemented a code generator in C\# that works using text substitution. It takes a plain-text template as input, and combines it with model data to produce a specific output. Within the generator, the dictionary is represented by a thin object layer. C\# attributes are used to denote the roles of the dictionary objects, and reflection is used to load and activate these objects as substitution tags. Occurrences of the tags in the templates are then replaced with actual values from the dictionary by the generator. In this way, we have successfully generated a C\# persistence layer for a legacy database, using its proprietary dictionary and newly written template files. The principle can equally be applied to descriptions of high-level functional services. Service access technology, for instance COM, CORBA or Web Services varies on a shorter timescale than do the services themselves, analogous to the variation of storage technology relative to data models. The same code generator has been used to generate service descriptions, based on platform-independent definitions in UML. Rational XDE was used to create the service definitions, and a th{\l}notin object layer encapsulated the XDE data model for the code generator. By creating the proper template files, we can generate both WSDL and COM IDL descriptions for our services, and even C\# implementation shells. Platform dependency is thus introduced through the templates, and the results may be reverse-engineered to derive an updated, platform-dependent model if needed. This approach achieves a high level of reuse, by concentrating on reusing descriptions instead of concrete, platform-dependent implementations. We have successfully used it as the basis for multiple commercial products within the same product family/line.}, year = {2004}, journal = {Practitioner{\textquoteright}s Report. ECOOP 2004, Oslo, Norway}, }