Refactoring the Whitby Intelligent Tutoring System for Clean Architecture

Paul S. Brown,Vania Dimitrova,Glen Hart,Anthony G. Cohn,Paulo Moura
DOI: https://doi.org/10.48550/arXiv.2108.04621
2021-08-10
Abstract:Whitby is the server-side of an Intelligent Tutoring System application for learning System-Theoretic Process Analysis (STPA), a methodology used to ensure the safety of anything that can be represented with a systems model. The underlying logic driving the reasoning behind Whitby is Situation Calculus, which is a many-sorted logic with situation, action, and object sorts. The Situation Calculus is applied to Ontology Authoring and Contingent Scaffolding: the primary activities within Whitby. Thus many fluents and actions are aggregated in Whitby from these two sub-applications and from Whitby itself, but all are available through a common situation query interface that does not depend upon any of the fluents or actions. Each STPA project in Whitby is a single situation term, which is queried for fluents that include the ontology, and to determine what pedagogical interventions to offer. Initially Whitby was written in Prolog using a module system. In the interest of a cleaner architecture and implementation with improved code reuse and extensibility, the initial application was refactored into Logtalk. This refactoring includes decoupling the Situation Calculus reasoner, Ontology Authoring framework, and Contingent Scaffolding framework into third-party libraries that can be reused in other applications. This extraction was achieved by inverting dependencies via Logtalk protocols and categories, which are reusable interfaces and components that provide functionally cohesive sets of predicate declarations and predicate definitions. In this paper the architectures of two iterations of Whitby are evaluated with respect to the motivations behind the refactor: clean architecture enabling code reuse and extensibility.
Programming Languages
What problem does this paper attempt to address?
The problem that this paper attempts to solve is to achieve a clearer architecture design in the Intelligent Tutoring System (ITS) in order to improve the reusability and extensibility of the code. Specifically, the paper discusses the process of refactoring a server - side application named Whitby. Whitby is an ITS application for learning System - Theoretic Process Analysis (STPA), which is a methodology for ensuring the safety of anything that can be represented by a system model. The underlying logic of Whitby is Situation Calculus, which is a multi - sorted logic that includes situation, action, and object sorts. Situation Calculus is applied to two main activities: ontology editing and Contingent Scaffolding. In the initial version, Whitby was written using the Prolog module system. However, as the complexity of the application increased, this architecture led to a series of problems, such as difficulty in code reuse and poor extensibility. These problems were mainly due to violations of the SOLID principles in software engineering, especially the Dependency Inversion Principle. To solve these problems, the author refactored Whitby into the Logtalk language. By inverting the dependencies, that is, making high - level strategies not depend on low - level details but on interfaces or protocols, decoupling between components was achieved. The refactored Whitby can better support code reuse and the extensibility of the system, and also improves the maintainability and testability of the code. In addition, by introducing Logtalk's protocols and categories mechanisms, the refactored Whitby can add new functions through extension without modifying the existing code, which complies with the Open - Closed Principle. In summary, this paper aims to show how to achieve a more modular, easy - to - maintain, and extensible intelligent tutoring system through refactoring.