35 research outputs found
Contracts in Practice
Contracts are a form of lightweight formal specification embedded in the
program text. Being executable parts of the code, they encourage programmers to
devote proper attention to specifications, and help maintain consistency
between specification and implementation as the program evolves. The present
study investigates how contracts are used in the practice of software
development. Based on an extensive empirical analysis of 21 contract-equipped
Eiffel, C#, and Java projects totaling more than 260 million lines of code over
7700 revisions, it explores, among other questions: 1) which kinds of contract
elements (preconditions, postconditions, class invariants) are used more often;
2) how contracts evolve over time; 3) the relationship between implementation
changes and contract changes; and 4) the role of inheritance in the process. It
has found, among other results, that: the percentage of program elements that
include contracts is above 33% for most projects and tends to be stable over
time; there is no strong preference for a certain type of contract element;
contracts are quite stable compared to implementations; and inheritance does
not significantly affect qualitative trends of contract usage
Run-Time Assertion Checking of Data- and Protocol-Oriented Properties of Java Programs: An Industrial Case Study
htmlabstractRun-time assertion checking is one of the useful techniques for detecting faults, and can be applied during any program execution context, including debugging, testing, and production. In general, however, it is limited to checking state-based properties. We introduce SAGA, a general framework that provides a smooth integration of the specification and the run-time checking of both data- and protocol-oriented properties of Java classes and interfaces. We evaluate SAGA, which combines several state-of-the art tools, by conducting an industrial case study from an eCommerce software company Fredhopper
Type-driven cross-programming for android and LEGO Mindstorms interoperability
We present Legodroid, a Java library for Android that allows cross-programming LEGO Mindstorms through an Android device to exploit its extra computational capabilities in a seamless way. From a programmer’s perspective, the paradigm it suggests for programming the EV3 is straightforward and resembles a standard main function in the likes of leJOS, which natively runs on the EV3 side though. Moreover, the library imposes type-driven coding patterns for interacting with motors and sensors, which guide developers in writing correct code with less runtime errors thanks to a rigid discipline over types. This is particularly effective in Android, whose component-based pattern complicates coding of traditional long-running algorithms for robots. Compared to leJOS, Legodroid users reported shorter bugfixing times and a more accessible paradigm for programming the robot, which had a positive impact on how much resources could be put in writing smarter algorithms and sophisticate interactions