The role of a sub-process is to make a problem easier to solve, especially when a problem requires repetition. A sub-process is synonymous with a function.
What is a sub-process
A sub-process is a named-part of a larger process. This sub-process can be called many times, like a function. A sub-process accepts input, processes the input, and returns a result.
Imagine we had a program which described monsters. The description of a monster can be ONLY ONE OF the following:
If we had 10 different monsters would it make sense for us to write this conditional 10 times?
def description_of_monster(value): if value == 1: return "fluffy" elif value == 2: return "spikey" elif value == 3: return "slimy" else: return "scary"
... of course not! It makes much more sense to create a sub-process so we can avoid repetition, increase efficiency, make our code more understandable.
Do you understand this?
These standards are used from the IB Computer Science Subject Guide
- ExplainGive a detailed account including reasons or causes. the role of sub-procedures in solving a problem.
- IB Diploma Programme Computer science guide (first examinations 2014). Cardiff, Wales, United Kingdom: International Baccalaureate Organization. January 2012.