So far we have been thinking which steps we should take to solve a certain problem, and creating programs translating each step intro commands. This is reasonable when the problems are simple, but may not be the best choice when it comes to something more complicated.
From now on we will start trying to break down problems into smaller pieces that are easier to solve. This should mean several advantages for us:
ñ Each independent "piece of program" will be easier to program, as it will have a brief and specific function.
ñ The "main program" will be easier to read, because it does not need to contain all the details on how to do everything.
ñ We can distribute the workload so that each person is responsible for making a "piece of program", and we finally integrate the individual work of each person.
These "pieces" of the program are called "subroutines", "procedures" or "functions". The most often used name in C language and its derivatives (as C#) is "functions".
No comments:
Post a Comment