Contract Programming Checker : A Study for Making an Automated Test Tool Using a Parser

University essay from Uppsala universitet/Institutionen för informationsteknologi

Author: Hamidreza Yazdani Najafabadi; [2009]

Keywords: ;

Abstract:

Thanks to computer software development, the communication industry hasevolved a lot during the last few years. Software and hardware integration made itpossible to exploit the best out of available equipments.

One of the important issues in software development process is to avoid bugs ordetect them in the early stage of development phase. Experiments have shown thatmost of the bugs are usually coming from the small fraction of the code. If this part ofthe code can be detected in advance then it is possible to benefit the cost of softwareproduction in great amount of time and money. Development teams have to makesure that they deliver a verified code to next team and that is why they obliged to usea concept called “contract programming”. It means expecting each module which isworking with other modules to respect to some kind of contract. As long as thecontract is respected in all module interactions, valid output will be guaranteed.

Several problems will remain in this approach. First issue is to make sure allnecessary contracts have been embedded to the code. On the other hand, contractsare memory and time consuming to check so try doing over protection results inweaker performance.

Considering the scalability problem, there is an urgent need for an automatic toolwhich is capable of checking against all possible defects to tell the programmer exactlywhere the contract is needed without performing any under or over protection.

This thesis tries to address this problem by generating a parser using UNIX tools,Lex (lexical analyzer) and Yacc (parser generator), to detect or worn about thepossible cause of defects. General built-in functions with different algorithms have alsobeen implemented in C language to perform different level of code analysis. Theoutcome of this thesis is a parser which fulfills three different requirements.

Firstly, checking all protected required places to check if they have been protectedby their proper contracts.

Secondly, notifying the extra contracts in places where they are not needed. It isdone by parser which analyzes the calling graph of different functions to verify if thecontracts are actually needed.

The last but not least requirement is to find the least protection required areas. Itmeans places where protection should be kept even if all internal computations areguaranteed to be correct. This facility will be used when the code wants to bedelivered to other teams and the internal integration of the code is already verified.

The tool is also capable of performing statistical analysis to give an exact percentageof protection in each function block and the software unit as a whole.

The Developed tool has successfully passed all of the exhaustive tests for furnishingthese requirements.

  AT THIS PAGE YOU CAN DOWNLOAD THE WHOLE ESSAY. (follow the link to the next page)