skip to main content
10.1145/1449764.1449768acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Deep typechecking and refactoring

Published:19 October 2008Publication History

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. Gavin M. Bierman, Erik Meijer, and Mads Torgersen. Lost in translatio n: formalizing proposed extensions to c. In OOPSLA, pages 479--498, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Aske Simon Christensen, Anders Møller, and Michael I. Schwartzbach. P recise analysis of string expressions. In SAS, pages 1--18, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. William R. Cook and Siddhartha Rai. Safe query objects: statically ty ped objects as remotely executable queries. In ICSE, pages 97--106, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Ezra Cooper, Sam Lindley, PhilipWadler, and Jeremy Yallop. Links: Web programming without tiers. In FMCO, LNCS 4709. Springer, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Jacques-Antoine Dub, Rick Sapir, and Peter Purich. Oracle application server toplink application developers guide, 10g (9.0.4). Oracle Corporation, 2 003.Google ScholarGoogle Scholar
  7. Michael Furr and Jeffrey S. Foster. Checking type safety of foreign f unction calls. In PLDI, pages 62--72, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. G. Hamilton and R. Cattell. Jdbc: A java sql api. Sun Microsystems, 1 997.Google ScholarGoogle Scholar

Index Terms

  1. Deep typechecking and refactoring

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!