15.04.2018 Views

programming-for-dummies

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

32<br />

Planning Ahead with Structured Programming<br />

Original<br />

Program<br />

Original<br />

Program<br />

Original<br />

Program<br />

Modification #5<br />

Figure 2-1:<br />

Constantly<br />

modifying a<br />

program<br />

eventually<br />

creates an<br />

unorganized<br />

mess.<br />

Modification #1<br />

Modification #2<br />

Modification #1<br />

Modification #3<br />

Modification #2<br />

Modification #4<br />

With constant modifications, a small, simple program can grow into a convoluted<br />

monstrosity that may work, but nobody quite understands how or why.<br />

Because the program consists of so many changes scattered throughout the<br />

code, trying to figure out how the program even works can get harder with<br />

each new modification.<br />

With a simple program, the computer follows each command from start to<br />

finish, so it’s easy to see how the program works. After a program gets modified<br />

multiple times, trying to follow the order of commands the computer follows<br />

can be like untangling spaghetti, hence the term spaghetti <strong>programming</strong>.<br />

As programs kept getting bigger and more complicated, computer scientists<br />

realized that just letting programmers rush out to write or modify a program<br />

wasn’t going to work any more. So that’s when computer scientists created<br />

the first <strong>programming</strong> techniques to help programmers write programs<br />

that’d be easy to understand and modify later.<br />

Planning Ahead with Structured Programming<br />

The problem with programs created without any planning is that it<br />

inevitably leads to a mess. So the first step involves keeping a program<br />

organized right from the start.

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

Saved successfully!

Ooh no, something went wrong!