@MASTERSTHESIS{pgi2020021, author = "P. O'Hear", supervisor = "M. Wood", title = "Analysing the use of casting in Java systems", school = "Department of Computer and Information Sciences, University of Strathclyde", year = "2019", abstract = "This project aims to investigate the seriousness and potential problems that may occur following the implementation of casting. Casting is a Java function that is used to convert the data type of an object to access type specific functionality. However, if a system requires the continuous use of casting, there are normally resulting issues later on in the program. To prevent this, developers should consider revising the system design rather than having to repeatedly use the type conversion operator. Having carried out an in depth investigation into the various opinions surrounding the use of casting, a software tool was developed to aid manual inspection of real life open source Java software systems. Various programs were analysed from the Qualitas Corpus, a collection of curated software systems that are used globally for research and development. The aim of this analysis was to provide a conclusion of each system to conclude whether or not they implement type conversions in an audacious manner and if code quality can be improved through the use of refactoring. The findings of this project certainly illustrate how the use of casting can snowball throughout the program, resulting in an abundance of type checks later required. An abundance of unnecessary conversions were due to programs frequently passing in Object data types. These then required multiple type checks and explicit casting functions. Although there were various suggestions made, the project came to the conclusion that no matter how well designed a system, conversions will be required at some point in the program. Future recommendations were also included to increase the usefulness of the output produced form the analysis tool.", }