Cunha J, Saraiva JA, Visser J.  2009.  From spreadsheets to relational databases and back. Proceedings of the workshop on Partial evaluation and program manipulation - PEPM. :179–188. Abstractpepm09.pdf

This paper presents techniques and tools to transform spreadsheets into relational databases and back. A set of data refinement rules is introduced to map a tabular datatype into a relational database schema. Having expressed the transformation of the two data models as data refinements, we obtain for free the functions that migrate the data. We use well-known relational database techniques to optimize and query the data. Because data refinements define bidirectional transformations we can map such database back to an optimized spreadsheet. We have implemented the data refinement rules and we have constructed tools to manipulate, optimize and refactor Excel-like spreadsheets.

Silva JC, Saraiva JA, Campos JC.  2009.  A Generic Library for GUI Reasoning and Testing. SAC - Proceedings of the ACM Symposium on Applied Computing. :121-128. Abstract2009-sachci-final.pdf

Graphical user interfaces (GUIs) make software easy to use by providing the user with visual controls. Therefore, correctness of GUI's code is essential to the correct execution of the overall software. Models can help in the evaluation of interactive applications by allowing designers to concentrate on its more important aspects. This paper presents a generic model for language-independent reverse engineering of graphical user interface based applications, and we explore the integration of model-based testing techniques in our approach, thus allowing us to perform fault detection. A prototype tool has been constructed, which is already capable of deriving and testing a user interface behavioral model of applications written in Java/Swing.

Pardo A, Fernandes JP, Saraiva JA.  2009.  Shortcut fusion rules for the derivation of circular and higher-order monadic programs. Workshop on Partial Evaluation and Program Manipulation. :81-90. Abstractpepm09.pdf

Functional programs often combine separate parts using intermediate data structures for communicating results. Programs so defined are modular, easier to understand and maintain, but suffer from inefficiencies due to the generation of those gluing data structures. To eliminate such redundant data structures, some program transformation techniques have been proposed. One such technique is shortcut fusion, and has been studied in the context of both pure and monadic functional programs.
In this paper, we study several shortcut fusion extensions, so that, alternatively, circular or higher-order programs are derived. These extensions are also provided for effect-free programs and monadic ones. Our work results in a set of generic calculation rules, that are widely applicable, and whose correctness is formally established.

Saraiva JA, Azanza M, Batory DS.  2008.  The objects and arrows of computacional design. Proceedings of 11th International Conference, MoDELS 2008. Abstractfulltext.pdf

Computational Design (CD) is a paradigm where both program design and program synthesis are computations. CD merges Model Driven Engineering (MDE) which synthesizes programs by transforming models, with Software Product Lines (SPL) where programs are synthesized by composing transforma tions called features. In this paper, basic relationships between MDE and SPL are explored using the language of modern mathematics.

Silva JC, Campos JC, Saraiva JA.  2007.  Combining Formal Methods and Functional Strategies Regarding the Reverse Engineering of Interactive Applications. Design, Specification and Verification: Interactive Systems - DSV-IS. 4323:137-150. Abstractjcsilva06.pdf

Graphical user interfaces (GUIs) make software easy to use by providing the user with visual controls. Therefore, correctness of GUI’s code is essential to the correct execution of the overall software. Models can help in the evaluation of interactive applications by allowing designers to concentrate on its more important aspects. This paper describes our approach to reverse engineer an abstract model of a user interface directly from the GUI’s legacy code. We also present results from a case study. These results are encouraging and give evidence that the goal of reverse engineering user interfaces can be met with more work on this technique.

Fernandes JP, Pardo A, Saraiva JA.  2007.  A shortcut fusion rule for circular program calculation. Haskell Workshop. :95-106. Abstracthw07.pdf

Circular programs are a powerful technique to express multiple traversal algorithms as a single traversal function in a lazy setting. In this paper, we present a shortcut deforestation technique to calculate circular programs. The technique we propose takes as input the composition of two functions, such that the first builds an intermediate structure and some additional context information which are then processed by the second one, to produce the final result. Our transformation into circular programs achieves intermediate structure deforestation and multiple traversal elimination. Furthermore, the calculated programs preserve the termination properties of the original ones.

Fernandes JP, Saraiva JA.  2007.  Tools and libraries to model and manipulate circular programs. Workshop on Partial Evaluation and Program Manipulation. :102-111. Abstract0f31752e977829fb98000000.pdf

This paper presents techniques to model circular lazy programs in a strict, purely functional setting. Circular lazy programs model any algorithm based on multiple traversals over a recursive data structure as a single traversal function. Such elegant and concise circular programs are defined in a (strict or lazy) functional language and they are transformed into efficient strict and deforested, multiple traversal programs by using attribute grammars-based techniques. Moreover, we use standard slicing techniques to slice such circular lazy programs. We have expressed these transformations as an Haskell library and two tools have been constructed: the HaCirctool that refactors Haskell lazy circular programs into strict ones, and the OCirctool that extends Ocaml with circular definitions allowing programmers to write circular programs in Ocaml notation, which are transformed into strict Ocaml programs before they are executed. The first benchmarks of the different implementations are presented and show that for algorithms relying on a large number of traversals the resulting strict, deforested programs are more efficient than the lazy ones, both in terms of runtime and memory consumption.

Silva JC, Campos JC, Saraiva JA.  2006.  Models for the Reverse Engineering of Java/Swing Applications. 3rd International Workshop on Metamodels, Schemas, Grammars, and Ontologies for Reverse Engineering. Abstractjcsilva06_jas.pdf

Interest in design and development of graphical user interface (GUIs) is growing in the last few years. However, correctness of GUI's code is essential to the correct execution of the overall software. Models can help in the evaluation of interactive applications by allowing designers to concentrate on its more important aspects. This paper describes our approach to reverse engineering abstract GUI models-based directly from the Java/Swing legacy code.

Silva JC, Campos JC, Saraiva JA.  2006.  Engenharia Reversa de Sistemas Interactivos Desenvolvidos em Java2/Swing. Interação 2006 - Actas da 2a. Conferência Nacional em Interação Pessoa-Máquina. :63-72. Abstractinter2006_jas.pdf

A manutenção e evolução de sistemas interactivos dá origem a problemas importantes que afectam a sua eficiência e eficácia. Neste trabalho pretende-se combinar programação funcional, programação estratégica, code slicing e modelos com semântica formal na tentativa de fortalecer a tese de que a aplicação destas metodologias e tecnologias, em conjunção com um processo de engenharia reversa de código fonte, permite melhorar significativamente o suporte à manutenção de sistemas interactivos.

Cunha A, Barros J B, Saraiva JA.  2002.  Deriving Animations from Recursive Definitions. Draft Proceedings of the 14th International Workshop on the Implementation of Functional Languages - IFL. Abstractifl02.pdf

This paper describes a generic method to derive an animation from a recursive de nition, with the objective of debugging and understanding this de nition by expliciting its control structure. This method is based on a well known algorithm of factorizing a recursive function into the composition of the producer and the consumer of its call tree. We developed a systematic method to transform both the resulting functions in order to draw the tree step by step. The theory of data types as xed points of functors, generic recursion patterns, and monads, are fundamental to our work and are brie y presented. Using polytypic implementations of monadic recursion patterns and an application to manipulate and generate graph layouts we developed a prototype that, given a recursive function written in a subset of Haskell, returns a function whose execution yields the desired animation.

Saraiva JA, Rebêlo H, Cunha J, Mendes J, Maia P.  2015.  Towards the Design and Implementation of Aspect-Oriented Programming for Spreadsheets. International Conference on Software Engineering (ICSE) Workshops. Abstract1503.03463v1.pdf

A spreadsheet usually starts as a simple and singleuser software artifact, but, as frequent as in other software systems, quickly evolves into a complex system developed by many actors. Often, different users work on different aspects of the same spreadsheet: while a secretary may be only involved in adding plain data to the spreadsheet, an accountant may define new business rules, while an engineer may need to adapt the spreadsheet content so it can be used by other software systems. Unfortunately, spreadsheet systems do not offer modular mechanisms, and as a consequence, some of the previous tasks may be defined by adding intrusive “code” to the spreadsheet. In this paper we go through the design and implementation of an aspect-oriented language for spreadsheets so that users can work on different aspects of a spreadsheet in a modular way. For example, aspects can be defined in order to introduce new business rules to an existing spreadsheet, or to manipulate the spreadsheet data to be ported to another system. Aspects are defined as aspect-oriented program specifications that are dynamically woven into the underlying spreadsheet by an a aspect weaver. In this aspect-oriented style of spreadsheet development, different users develop, or reuse, aspects without adding intrusive code to the original spreadsheet. Such code is added/executed by the spreadsheet weaving mechanism proposed in this paper.

Saraiva JA, Martins P, Zhu Z, Ko H-S, Hu Z.  2015.  BiYacc: Roll Your Parser and Reflective Printer into One. Fourth International Workshop on Bidirectional Transformations (Bx 2015). :43-50. Abstractp43-zhu_1.pdf

Language designers usually need to implement parsers and printers. Despite being two related programs, in practice they are designed and implemented separately. This approach has an obvious disadvantage: as a language evolves, both its parser and printer need to be separately revised and kept synchronised. Such tasks are routine but complicated and error-prone. To facilitate these tasks, we propose a language called BiYacc, whose programs denote both a parser and a printer. In essence, BiYacc is a domain-specific language for writing putback-based bidirectional transformations — the printer is a putback transformation,
and the parser is the corresponding get transformation. The pairs of parsers and printers generated by BiYacc are thus always guaranteed to satisfy the usual round-trip properties. The highlight that distinguishes this reflective printer from others is that the printer —being a putback transformation — accepts not only an abstract syntax tree but also a string, and produces an updated string consistent with the given abstract syntax tree. We can thus make use of the additional input string, with mechanisms such as simultaneous pattern matching on the view and the source, to provide users with full control over the printing-strategies.

Lammel R, Saraiva JA, Visser J.  2013.  Generative and Transformational Techniques in Software Engineering. GTTSE - International Summer School. Abstract

This tutorial book presents revised and extended lecture notes for a selection of the contributions presented at the International Summer School on Generative and Transformational Techniques in Software Engineering (GTTSE 2009), which was held in Braga, Portugal, in July 2009. The 16 articles comprise 7 long tutorials, 6 short tutorials and 3 participants contributions; they shed light on the generation and transformation of programs, data, models, metamodels, documentation, and entire software systems. The topics covered include software reverse and re-engineering, model driven engineering, automated software engineering, generic language technology, and software language engineering.

Cunha J, Fernandes JP, Mendes J, Saraiva JA.  2015.  Embedding, Evolution, and Validation of Spreadsheet Models in Spreadsheet Systems. IEEE Transactions on Software Engineering. 41(3):241-263. Abstracttse14.pdf

This paper proposes and validates a model-driven software engineering technique for spreadsheets. The technique that we envision builds on the embedding of spreadsheet models under a widely used spreadsheet system. This means that we enable the creation and evolution of spreadsheet models under a spreadsheet system. More precisely, we embed ClassSheets, a visual language with a syntax similar to the one offered by common spreadsheets, that was created with the aim of specifying spreadsheets. Our embedding allows models and their conforming instances to be developed under the same environment. In practice, this convenient environment enhances evolution steps at the model level while the corresponding instance is automatically co-evolved. Finally, we have designed and conducted an empirical study with human users in order to assess our technique in production environments. The results of this study are promising and suggest that productivity gains are realizable under our model-driven spreadsheet development setting.

Cunha J, Saraiva JA, Visser J.  2014.  Model-Based Programming Environments for Spreadsheets. Science of Computer Programming . 96:254-275. Abstractjscp-si-sblp12.pdf

Spreadsheets can be seen as a flexible programming environment. However, they lack some of the concepts of regular programming languages, such as structured data types. This can lead the user to edit the spreadsheet in a wrong way and perhaps cause corrupt or redundant data. We devised a method for extraction of a relational model from a spreadsheet and the subsequent embedding of the model back into the spreadsheet to create a model-based spreadsheet programming environment. The extraction algorithm is specific for spreadsheets since it considers particularities such as layout and column arrangement. The extracted model is used to generate formulas and visual elements that are then embedded in the spreadsheet helping the user to edit data in a correct way. We present preliminary experimental results from applying our approach to a sample of spreadsheets from the EUSES Spreadsheet Corpus. Finally, we conduct the first systematic empirical study to assess the effectiveness and efficiency of this approach. A set of spreadsheet end users worked with two different model-based spreadsheets, and we present and analyze here the results achieved.