Software systems are expected to change over their lifetime in order to remain useful. Understanding a software system that has undergone changes is often difficult due to unavailability of up-to-date documentation. Under these circumstances, source code is the only reliable means of information regarding the system. In this paper, we apply data mining, or more specifically, association rule mining, to the problem of software understanding i.e. given the source files of a software system, we use association rule mining to gain insight about the software. Our purpose is to explore the use of association rule mining for finding interesting associations within the software that can lead to program understanding. To make association rule mining more effective, we place constraints on the mining process in the form of metarules. Metarule-guided mining is carried out to find associations which can be used to identify recurring problems within software systems. We relate metarules to re-engineering patterns which present solutions to these problems. We apply association rule mining to five legacy systems and present results which show how extracted association rules can be helpful in analyzing the structure of a software system and in suggesting modifications to improve the structure. A comparison of the results obtained for the five systems also reveals legacy system characteristics, which can lead to understanding the nature of open source legacy software and its evolution.