Usage contracts: Offering immediate feedback on violations of structural source-code regularities

Angela Lozano Rodriguez, Kim Mens, Andy Kellens

Research output: Contribution to journalArticlepeer-review

6 Citations (Scopus)


Abstract Developers often encode design knowledge through structural regularities such as API usage protocols, coding idioms and naming conventions. As these regularities express how the source code should be structured, they provide vital information for developers using or extending that code. Adherence to such regularities tends to deteriorate over time because they are not documented and checked explicitly. This paper introduces uContracts, an internal DSL to codify and verify such regularities as ‘usage contracts’. Our DSL aims at covering most common usage regularities, while still providing a means to express less common ones. Common regularities are identified based on regularities supported by existing approaches to detect bugs or suggest missing code fragments, techniques that mine for structural regularities, as well as on the analysis of an open-source project. We validate our DSL by documenting the structural regularities of an industrial case study, and analyse how useful the information provided by checking these regularities is for the developers of that case study.
Original languageEnglish
Pages (from-to)73-91
Number of pages19
JournalScience of Computer Programming
Publication statusPublished - 1 Jul 2015


  • Software development tool support
  • Structural regularities
  • Source code analysis
  • Internal domain-specific language
  • IDE integration


Dive into the research topics of 'Usage contracts: Offering immediate feedback on violations of structural source-code regularities'. Together they form a unique fingerprint.

Cite this