When is it useful to include the code in a thesis?

Making your code available along with your thesis can be very helpful to other researchers who are trying to reproduce your results. I'd encourage you to do this.

However, you should not simply insert a printout of your code into the text of the thesis, since that will make it difficult (practically impossible) for someone to use the code that they obtain from a printed copy of the thesis or even a .PDF of the thesis. Rather, you should put the code into some online repository (such as e.g. github) so that others can download the code from the web.


@Brian Borchers's answer is sound, and it sounds like it would apply best in your case.

However, if you used a particularly interesting or novel algorithm to generate your input files (that is, you had unusual insight into how best to solve your problem that might help others), then in addition to linking your code to an online repository, you could provide a pseudocode description of that algorithm in your main body or an appendix, depending on flow. (If you're not sure if your process is sufficiently interesting, ask your advisor.)


In computer science, I am very much used to (and encourage) theses that contain any noteworthy code snippets as floats. In fact, as theses provide virtually unlimited space, there is no need for the extreme brevity of papers and a Concept chapter that describes the rationale for design decisions in the developed concept is usually followed by an Implementation chapter that can describe the implemented version in depth, including (but not limited to) showing presentation-worthy excerpts of the source code.

In most cases, this does not mean that whole source code files should be printed. This is usually referring to a few lines of code, or single methods that implement a specific algorithm.

For input/output files, things are similar, and they may be even more important than code snippets, as they may explain the handling and actual output of a prototype developed as a part of the thesis.

Contrary to various other answers here, I advise against putting any source code in the appendix in the usual case. The appendix is for extensive information that may be needed for further reference, but which is too "boring" to integrate in its entirety in the main body of text. This implies that the information in the appendix should be optimized so it can be taken advantage of in a meaningful way. In other words, the appendix in a (printed) document may be good for human-readable questionnaires or sets of tables, but full source code files should always be delivered in digital form (and in universities I am familiar with, (at least CS) theses have to be handed in as printed documents that are accompanied by a CD). Source code snippets that go into the main body of text as floats serve the same purpose as figures, tables or formulas in the main body of text - they illustrate something which would be too cumbersome to describe in the text.

Tags:

Thesis

Code