Recently I am using a software package which seems pretty useful, but which I don't understand how it works internally.
This package contains software generated by several PhD students and lecturers of an university among several years, which reflects in code style. There are several papers related to pieces of this software, which I have read them but still, I am not sure I understood them correctly.
I decided to look inside the source code to understand what and how does it work:
The package lacks of test, sometimes there are defined functions that the programming language has already implemented (it is R if that matters), or two functions with overlapping functionality, different ways of notifying the user (it uses message
, cat
or write
), and functions with 30 parameters. I found also some errors in functions (using a variable name which is the same as a base function name instead of a variable name defined inside the function). Or it defines a new class but doesn't define methods for such class, thus making many lines of code duplicated.
I went on to try to understand the package and improve its coherence, I started by unifying the style and adding test (first time using tests), but since I am not sure of the expected output I am just testing against the results it gives for each option, or for the structure. After some time I would like to start modifying some functions, and check with the already written test that they don't break any.
What else should I do to improve the package and my understanding of it? How can I efficiently improve my understanding of the package?