Deep Typechecking and Refactoring

Zachary Tatlock,  Chris Tucker,  David Shuffelton,  Ranjit Jhala,  Sorin Lerner

Object-Oriented Programming, Systems, Languages & Applications (OOPSLA) 2008

Deep Typechecking and Refactoring

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. 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.

BibTeX

@inproceedings{2008-oopsla-dtar,
  title     = {Deep Typechecking and Refactoring},
  author    = {Tatlock, Zachary and Tucker, Chris and Shuffelton, David and Jhala, Ranjit and Lerner, Sorin},
  series    = {OOPSLA 2008},
  booktitle = {Proceedings of the 23rd ACM SIGPLAN Conference on Object-Oriented Programming Systems Languages and Applications},
  url       = {https://doi.org/10.1145/1449764.1449768},
  doi       = {10.1145/1449764.1449768},
  publisher = {Association for Computing Machinery},
}

📝 publications index