Chapter 6
Breaking a Large Program into Subprograms
IN THIS CHAPTER
Using a subprogram
Passing parameters
Using recursion
The bigger the program, the harder that program is to read, fix, and modify. Just as it’s easier to spot a spelling mistake in a recipe printed on a single page than it is to find that same spelling mistake buried inside a 350-page cookbook, it’s easier to fix problems in a small program than it is in a big one.
Because small programs can perform only simple tasks, the idea behind programming is to write a lot of little programs and paste them together, like building blocks, creating one massive program. Because each little program is part of a much bigger program, those little programs are subprograms, as shown in Figure 6-1.
Get Beginning Programming All-in-One For Dummies, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.