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.

Chapter 1: How Programs Work<br />

In This Chapter<br />

Using keywords<br />

Arranging a Program<br />

Dividing programs into subprograms and objects<br />

Building a user interface<br />

Programming is nothing more than problem-solving. Every program is<br />

designed to solve a specific problem, such as taking the trouble out of<br />

editing text (a word processor), calculating rows and columns of numbers<br />

(spreadsheets), or searching and sorting in<strong>for</strong>mation (a database).<br />

Be<strong>for</strong>e you write any program, you must first know what problem you want<br />

the computer to solve. Computers are best at solving repetitive tasks, such<br />

as calculating rows and columns of numbers in a spreadsheet. Anyone can<br />

do similar calculations by hand, but computers make the task much faster<br />

and accurate.<br />

After you know what problem to solve, the next step is figuring out how to<br />

solve that problem. Many problems may have multiple solutions. For example,<br />

how can someone get from the airport to your house? One way might be<br />

to take the highway, which may be the simplest route although not necessarily<br />

the fastest. Another way may take you through winding roads that can<br />

be harder to navigate.<br />

In general, every problem has multiple solutions with each solution having<br />

its pros and cons. Should you tell someone to take the shortest way to your<br />

house (which might be harder to follow) or the easiest way to your house<br />

(which might take longer to get there)?<br />

Computer programs face this same dilemma in choosing the “best” solution.<br />

One solution might be slow, but require less memory to run. Another solution<br />

might be fast, but require gobs of memory. When deciding on a solution,<br />

you always have to consider additional factors, such as what type of computer<br />

the program runs on, what type of environment the program is used<br />

in, and what type of people are using it.<br />

After you choose a solution, the next step involves dissecting how your<br />

chosen solution works so that you can translate those steps into instructions<br />

<strong>for</strong> the computer to follow.

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

Saved successfully!

Ooh no, something went wrong!