ABSTRACT
Large software systems are typically composed of multiple layers, written in different languages and loosely coupled using a string-based interface. For example, in modern web-applications, a server written in Java communicates with a database back-end by passing in query strings. This widely prevalent approach is unsafe as the analyses developed for the individual layers are oblivious to the semantics of the dynamically constructed strings, making it impossible to statically reason about the correctness of the interaction. Further, even simple refactoring in such systems is daunting and error prone as the changes must also be applied to isolated string fragments scattered across the code base.
We present techniques for deep typechecking and refactoring for systems that combine Java code with a database back-end using the Java Persistence API [10]. Deep typechecking ensures that the queries that are constructed dynamically are type safe and that the values returned from the queries are used safely by the program. Deep refactoring builds upon typechecking to allow programmers to safely and automatically propagate code refactorings through the query string fragments.
Our algorithms are implemented in a tool called QUAIL. We present experiments evaluating the effectiveness of QUAIL on several benchmarks ranging from 3,369 to 82,907 lines of code.We show that QUAIL is able to verify that 84% of query strings in our benchmarks are type safe. Finally, we show that QUAIL reduces the number of places in the code that a programmer must look at in order to perform a refactoring by several orders of magnitude.
- Malcolm P. Atkinson, Laurent Dayn`es, Mick J. Jordan, Tony Printezis, and Susan Spence. An orthogonally persistent java. SIGMOD Record, 25(4):68--75, 1996. Google Scholar
Digital Library
- Gavin M. Bierman, Erik Meijer, and Mads Torgersen. Lost in translatio n: formalizing proposed extensions to c. In OOPSLA, pages 479--498, 2007. Google Scholar
Digital Library
- Aske Simon Christensen, Anders Møller, and Michael I. Schwartzbach. P recise analysis of string expressions. In SAS, pages 1--18, 2003. Google Scholar
Digital Library
- William R. Cook and Siddhartha Rai. Safe query objects: statically ty ped objects as remotely executable queries. In ICSE, pages 97--106, 2005. Google Scholar
Digital Library
- Ezra Cooper, Sam Lindley, PhilipWadler, and Jeremy Yallop. Links: Web programming without tiers. In FMCO, LNCS 4709. Springer, 2006. Google Scholar
Digital Library
- Jacques-Antoine Dub, Rick Sapir, and Peter Purich. Oracle application server toplink application developers guide, 10g (9.0.4). Oracle Corporation, 2 003.Google Scholar
- Michael Furr and Jeffrey S. Foster. Checking type safety of foreign f unction calls. In PLDI, pages 62--72, 2005. Google Scholar
Digital Library
- G. Hamilton and R. Cattell. Jdbc: A java sql api. Sun Microsystems, 1 997.Google Scholar
Index Terms
Deep typechecking and refactoring
Recommendations
Deep typechecking and refactoring
Large software systems are typically composed of multiple layers, written in different languages and loosely coupled using a string-based interface. For example, in modern web-applications, a server written in Java communicates with a database back-end ...
Cross language refactoring for Eclipse plug-ins
WRT '08: Proceedings of the 2nd Workshop on Refactoring ToolsThis article presents our research on how a cross-language refactoring could be implemented in an Eclipse Plugin.
A non-Java language running on the Java virtual machine JVM interacts with Java code. Refactorings in either language might break the code ...
Tridirectional typechecking
POPL '04In prior work we introduced a pure type assignment system that encompasses a rich set of property types, including intersections, unions, and universally and existentially quantified dependent types. This system was shown sound with respect to a call-by-...







Comments