The spec is out there, Extracting contracts from code

Examensarbete för masterexamen

Please use this identifier to cite or link to this item: https://hdl.handle.net/20.500.12380/256246
Download file(s):
File Description SizeFormat 
256246.pdfFulltext603.51 kBAdobe PDFView/Open
Type: Examensarbete för masterexamen
Master Thesis
Title: The spec is out there, Extracting contracts from code
Authors: Medin, Christoffer
Doverstav, Pontus
Abstract: A contract is a formal specification of the properties of a method. It has many uses in testing, verification and documentation. Despite all these benefits, developers almost never write contracts for their code due to the large amount of time required to write correct and expressive contracts. The project described in this thesis sets out to evaluate the possibility of extracting contracts from code using syntactic analysis, which is a not yet evaluated technique. Syntactic analysis is done by looking at the operations performed by code, rather than the result of those operations. Contracts were extracted by first parsing target source code into an abstract syntax tree, which was then analyzed to find defined code patterns which signaled the presence of some implicit contract. The information found within these patterns was then extracted and written as an explicit contract. In experiments involving 4 projects over 35 000 methods, our syntactic analysis tool extracted close to 60 000 behaviors, of which one-third were regarded as successful. The results are promising, even though performance of the syntactic analysis was somewhat inconsistent, it could produce contracts on a comparable level to those written by a human.
Keywords: Data- och informationsvetenskap;Computer and Information Science
Issue Date: 2017
Publisher: Chalmers tekniska högskola / Institutionen för data- och informationsteknik (Chalmers)
Chalmers University of Technology / Department of Computer Science and Engineering (Chalmers)
URI: https://hdl.handle.net/20.500.12380/256246
Collection:Examensarbeten för masterexamen // Master Theses



Items in DSpace are protected by copyright, with all rights reserved, unless otherwise indicated.