Defining contracts and generating stubs