Alysson Milanez, Bianca Lima, José Ferreira, T. Massoni
{"title":"Nonconformance between programs and contracts: a study on C#/code contracts open source systems","authors":"Alysson Milanez, Bianca Lima, José Ferreira, T. Massoni","doi":"10.1145/3019612.3019779","DOIUrl":null,"url":null,"abstract":"Detecting nonconformances between contracts and code is critical in contract-based programs, although detection is only the first step in correction; one needs to pinpoint their causes. For example, a nonconformance may be due to a method precondition that is weaker than it should be, or maybe the program behavior breaks the corresponding contracts. Previous research on contract-based programs lacks evidence about the most frequent causes for nonconformances. Either, no previous work elaborate on the effort required for establishing a likely cause. In this work, from 63 automatically-detected nonconformances found in 12 open source C#/Code Contracts systems, we manually analyze their likely causes, among contract or code defects. We observe nonconformances are frequently due to the weakness of preconditions, or to programs failing to fulfill contracts that seem appropriate to the problem at hand, although most nonconformances cause failures at the exit of operations (postcondition and invariant nonconformances sum up to 35). We also report on the obstacles in determining a likely cause, in which context information about the affected program fragment is often relevant.","PeriodicalId":20728,"journal":{"name":"Proceedings of the Symposium on Applied Computing","volume":null,"pages":null},"PeriodicalIF":0.0000,"publicationDate":"2017-04-03","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the Symposium on Applied Computing","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3019612.3019779","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
Detecting nonconformances between contracts and code is critical in contract-based programs, although detection is only the first step in correction; one needs to pinpoint their causes. For example, a nonconformance may be due to a method precondition that is weaker than it should be, or maybe the program behavior breaks the corresponding contracts. Previous research on contract-based programs lacks evidence about the most frequent causes for nonconformances. Either, no previous work elaborate on the effort required for establishing a likely cause. In this work, from 63 automatically-detected nonconformances found in 12 open source C#/Code Contracts systems, we manually analyze their likely causes, among contract or code defects. We observe nonconformances are frequently due to the weakness of preconditions, or to programs failing to fulfill contracts that seem appropriate to the problem at hand, although most nonconformances cause failures at the exit of operations (postcondition and invariant nonconformances sum up to 35). We also report on the obstacles in determining a likely cause, in which context information about the affected program fragment is often relevant.