Invariants and Code Contracts in an Online Classroom Environment - Barata, Rui Pedro de Almeida (2023)
Programming education has evolved significantly with the advent of online classroom environments, offering both advantages and challenges. This dissertation explores the integration of code contracts and invariants into programming education, with a focus on the OCaml language. The primary objective is to develop a tool that translates student-written code contracts and invariants into executable assertions, enhancing software reliability and correctness. In the pursuit of this objective, several key contributions are presented. First, an in-depth analysis of online classroom environments, highlighting the importance of addressing software reliability in this context. The Learn-OCaml platform is introduced as a valuable educational resource, offering a unique blend of contest-like challenges and comprehensive lessons. The dissertation delves into code contracts and invariants, elucidating their significance in ensuring code behaves as intended. It surveys existing code contract tools and the relevance of online classroom environments. The research demonstrates how a modified Gospel specification language can be harnessed to integrate code contracts into OCaml programs. The implementation phase of the project is detailed, outlining the process of translating components like preconditions, postconditions, invariants, and variants from Gospel specifications into actionable OCaml code. Limitations of the tool, especially in handling quantifiers, are acknowledged. The dissertation concludes with a summary of achievements and contributions, addressing the research problem of enhancing software reliability and correctness in online programming education. Future work is proposed, including the addition of quantifier support and the incorporation of the developed tool into the Learn-OCaml platform, fostering automated grading and assertion comparison. This work represents a significant step toward improving the quality of programming education in online classrooms, empowering students to write more reliable and correct code while offering educators enhanced tools for assessment and feedback.