I am writing my bachelor's thesis in software engineering. It is split into two parts: a theoretical part where I analyze existing literature, compare models and draw conclusions; and a part where I present my software solution to a problem using the patterns defined in the theoretical part.

A chapter in the theoretical part is about a process called Domain Driven Design, where it is natural to put code examples as they make it easier to understand the concepts. My code examples are not connected to the software I created.

Should I put code examples not directly connected to my app in the theoretical part of a thesis? Or is it enough if I only define concepts without examples? (in the second part they will be referenced anyways during the analysis of my app)

  • 1
    Welcome to Writing.SE David! If you have a moment, please check out our help center and take the tour. Commented Mar 29, 2018 at 12:55

2 Answers 2


Theoretical concepts are always difficult to understand without examples. Plus, the examples can provide evidence of the soundness of the concepts and generally increase the reader's confidence both in their understanding of the concepts and in the soundness of the concepts themselves.

So yes, including examples in you conceptual material is a good idea. If the concept you are explaining is complex or unfamiliar, it is also good to build it up in layers with examples for each layer as you introduce it. An example that is built up piece by piece from simpler parts is usually easier to comprehend than one that is presented as a single entity with all of its complexity. It is very easy to overestimate the clarity of concepts we are familiar with, so breaking it down into pieces and explaining and illustrating each piece is a good thing, even if it seems unnecessarily slow to you.

Finally, consider whether it might be better to show your examples in pseudocode rather than actual code. Not only does this avoid issues with some readers not being familiar with the language of the code, but pseudocode can be written to highlight the concept you are explaining while avoiding bits of technical complexity not relevant to the point at hand.

  • In the meantime, I realized that the source of uncertainty is that I don't really know the target audience of a BSC thesis, in general. My supervisors are familiar with concepts, so examples are not necessary for them (or necessary in the sense they prove my understanding of the domain). However, if I assume a broader audience, they are good to have. By the way, I showed my progress to one supervisor, and he liked it with the examples. I will rewrite existing examples to pseudocode, it will be good for brevity also. Commented Mar 29, 2018 at 14:16
  • @DavidSzalai Even if all problems a thesis discusses are familiar to the readership, the thesis is likely to contribute a new way of thinking about at least the harder problems. Such a perspective is worth introducing by showing how it considers easier ones. In Chapter 1 of my PhD thesis (I realise a BSc is a bit different), I discussed a relatively simple problem and a solution to it; I saved the two "real" problems of the thesis for Chapter 2, and their solutions for Chapters 3 and 4. My external examiner described this approach as "wise".
    – J.G.
    Commented Mar 29, 2018 at 17:06

I strongly suggest that you ask your professor (or whoever else will grade your thesis) how they expect this to be done.

There is no universal rule for this, rather it is a matter of preference and taste.

Personally, I find it makes a lot of sense to give examples for theoretical concepts.

But if you refer to them from different parts of your text, it is usually sufficient to give them only once (e.g. near the first reference or in an appendix) and then refer to them (e.g. by example number) from elsewhere in your text.

It is uncommon to give the same code more than once in a thesis or paper.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.