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.

Teaching Languages 57<br />

near future. If you study Logo just to explore new ways of thinking, you<br />

won’t be disappointed.<br />

Book I<br />

Chapter 3<br />

Logo relies primarily on an interpreter instead of a compiler because an<br />

interpreter can give you instant feedback <strong>for</strong> each command you type into<br />

the computer.<br />

The philosophy of Pascal<br />

Unlike BASIC or Logo, which was designed to make <strong>programming</strong> interactive<br />

and fun, Pascal was designed to <strong>for</strong>ce programmers to design and organize a<br />

program using structured <strong>programming</strong> techniques (see Book I, Chapter 2).<br />

Types of<br />

Programming<br />

Languages<br />

Early versions of BASIC made it easy to write spaghetti programs because a<br />

BASIC program consisted essentially of one glob of commands lumped<br />

together inside a single file. The larger your BASIC program got, the more<br />

confusing it became to read and understand.<br />

Pascal tackled this problem by encouraging programmers to divide a large<br />

program into smaller subprograms. Each subprogram would solve a single<br />

problem and act like a Lego building block. Slap enough subprograms<br />

together and you could create a much larger and more complicated program.<br />

Although Pascal was initially designed to teach good <strong>programming</strong> habits,<br />

Pascal eventually became popular <strong>for</strong> writing many commercial programs.<br />

Early versions of the Macintosh operating system were even written in<br />

Pascal. Computer scientists eventually added so many features to Pascal<br />

that Pascal’s power could nearly rival that of the C language.<br />

For a brief period of time during the 1980s, Pascal was arguably more popular<br />

than BASIC. One of the most popular Pascal compilers of all time was Borland<br />

Software’s Turbo Pascal, which later morphed into the event-driven, objectoriented<br />

<strong>programming</strong> language that’s now known as Delphi (www.turbo<br />

explorer.com).<br />

Pascal’s greatest strength was that it was almost as easy to understand as<br />

BASIC and almost as fast, efficient, and powerful as C. Reading a Pascal program<br />

was much easier than reading a similar C program, as the following<br />

programs demonstrate.<br />

Program Hello_World;<br />

Begin<br />

Writeln (‘Hello World!’);<br />

End.

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

Saved successfully!

Ooh no, something went wrong!