sabato 29 ottobre 2011

Mining Clementine

Before going deeply into the issues, I decided to follow the "Read all the code in one hour" pattern to get some clues on how the system behaves and what kind of design could be involved. At first glance, the first remarkable features of this software is that it is completely built o top of the QT 4 framework. From a certain point of view, since I have no experience with this framework, it took more time to understand what some parts where doing since I needed to go through the QT documentation. However, I was able to recognize some patterns used in the software. For example, I noticed the use of Factory pattern all over the place (e.g. songs, proxy connection, filesystem, tag library) and the Observer pattern to continuously check for changes in the state of the files (e.g. LibraryWatcher).

As another remarkable "feature", I found out an alternation between parts in which comments are practically absent (including the meta-object generated by QT) and parts in wich comments are of high quality and they act as documentation. However, those comments are the only documentation available for the system.

According to the clues I got when I reproduced the bug, I started looking at the UI as an entry point in the system and I begun by following a Top-Down approach. I was able to identify the right UI file (edittagdialog.ui) and I started checking if the creation date and the modification date were erroneously displayed but I sooner discovered that it was not the case. Thus, I had to go deeper and I noticed the Song class is the one responsible to represents and load information and meta-information from music files and from the internal database.

I wanted to check if it was the case that the information was erroneously inserted in the object. Thus, I checked the methods (Song::InitFromFile and Song::InitFromQuery) that are responsible to fetch information from files. There, I found out that one of my first hypothesis was right: Clementine reads both creation and modification date from filesystem.

This means that somewhere else creation date and modification date are modified when the meta-information (tags) are updated or a new file is inserted in the library. My new hypothesis is that this is done somewhere in the library or in the internal database. Therefore, I will look into them as a next move.

Nessun commento:

Posta un commento