  Prototyping is an effective and efficient way of requirement validation to
avoid introducing errors in the early stage of software development. However,
manually developing a prototype of a software system requires additional
efforts, which would increase the overall cost of software development. In this
paper, we present an approach with a developed tool to automatic generation of
prototypes from formal requirements models. A requirements model consists of a
use case diagram, a conceptual class diagram, use case definitions specified by
system sequence diagrams and the contracts of their system operations. We
propose a method to decompose a contract into executable parts and
non-executable parts. A set of transformation rules is given to decompose the
executable part into pre-implemented primitive operations. A non-executable
part is usually realized by significant algorithms such as sorting a list,
finding the shortest path or domain-specific computation. It can be implemented
manually or by using existing code. A CASE tool is developed that provides an
interface for developers to develop a program for each non-executable part of a
contract, and automatically transforms the executables into sequences of
pre-implemented primitive operations. We have conducted four cases studies with
over 50 use cases. The experimental result shows that the 93.65% of requirement
specifications are executable, and only 6.35% are non-executable such as
sorting and event-call, which can be implemented by developers manually or
invoking the APIs of advanced algorithms in Java library. The one second
generated the prototype of a case study requires approximate nine hours manual
implementation by a skilled programmer. Overall, the result is satisfiable, and
the proposed approach with the developed CASE tool can be applied to the
software industry for requirements engineering.
