15.04.2018 Views

programming-for-dummies

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Organizing a Program 131<br />

So if your program isn’t printing correctly, you don’t have to search through<br />

your entire program to find the faulty commands. Instead, you can just look<br />

at the part of your program where you grouped all your printing commands,<br />

as shown in Figure 1-3.<br />

Printing commands<br />

Math commands<br />

Math commands<br />

Math commands<br />

Saving commands<br />

Math commands<br />

Saving commands<br />

Saving commands<br />

Book II<br />

Chapter 1<br />

Figure 1-3:<br />

Dividing a<br />

large<br />

program<br />

into parts<br />

can make it<br />

easy to find<br />

specific<br />

commands<br />

in your<br />

program.<br />

Printing commands<br />

Saving commands<br />

Printing commands<br />

Storing commands with no<br />

organization makes the<br />

program harder to read<br />

and understand.<br />

Printing commands<br />

Printing commands<br />

Printing commands<br />

By just organizing related<br />

commands together, you<br />

can make a program easier<br />

to read and understand.<br />

How Programs<br />

Work<br />

When you write a simple program that consists of a handful of commands,<br />

organizing related commands in groups isn’t too important, but when you<br />

start writing bigger programs that consist of hundreds or thousands of commands,<br />

organizing commands can mean the difference between writing a<br />

program that nobody can understand or a program that’s easy <strong>for</strong> anyone to<br />

understand and modify.<br />

When you save your program, you save it as a single file on the computer.<br />

However, the more commands you write, the bigger your program gets, and<br />

the bigger the file you need to store the whole program.<br />

No matter how carefully you organize your commands, eventually your program<br />

will get too big and cumbersome as a single massive file to read and<br />

modify easily. That’s when you need to break your program into smaller<br />

parts.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!