3 Chapter 3: Types of Programming Languages Your First Language Curly-Bracket Languages Artificial Intelligence Languages Scripting Languages Database Programming Languages Comparing Programming Languages
4 Chapter 4: Programming Tools Choosing a Compiler Finding an Interpreter Compiling to a Virtual Machine Writing a Program with an Editor Fixing a Program with a Debugger Saving Time with Third-Party Components Optimizing a Program with a Profiler Managing Source Code Creating a Help File Installing a Program Dissecting Programs with a Disassembler
Chapter 1
Getting Started Programming a Computer
IN THIS CHAPTER
Understanding how computer programming works
Diving into the history of computer programming
Discovering programming
Believe it or not, if you can write a recipe on an index card, you can program a computer! At the simplest level, computer programming is nothing more than writing instructions for a computer to follow, step-by-step. The most important part of programming isn’t knowing how to write a program or how to use a particular programming language, but knowing what to create in the first place.
Some of the most popular and useful computer programs were created by people who didn’t have any formal training in math or computer science. Dan Bricklin invented the spreadsheet while studying for his MBA at Harvard. Scott Cook, who worked in marketing and product development at Procter & Gamble, created the popular money-management program Quicken after hearing his wife complain about the tedium of paying bills. Nineteen-year-old Shawn Fanning created Napster, the first peer-to-peer file-sharing network, after hearing a friend complain about the difficulty of finding his favorite songs on the Internet. Game developer Dona Bailey wanted to create a video game that would appeal to both men and women; as the only woman working at Atari’s coin-op division, she created the video game Centipede, which became Atari’s second best-selling coin-op game.
The point is that anyone can figure out how to program a computer. What’s more important than knowing how to program a computer is knowing what to do with your programming skills. As Albert Einstein said, “Imagination is more important than knowledge.” After you have an idea for a program, you can use programming to turn your idea into reality.
How Computer Programming Works
Computer programming is nothing more than problem solving. Every program is designed to solve a specific problem. The more universal the problem (calculating formulas in a spreadsheet, managing your money, searching for music files over the Internet, or keeping people amused playing a game creating virtual buildings), the more useful and popular the program will be.
Identifying the problem
Before you even touch a computer, identify the specific problem you want the computer to solve. For example, spreadsheets eliminate the tedium of writing and calculating formulas manually. Word processors make editing and formatting text fast and easy. Even video games solve the problem of challenging people with puzzles, obstacles, and battles.
Although the most popular programs solve universal problems, literally thousands of programs are designed to solve specific problems in niche markets, such as hotel reservation software, construction billing and invoice management programs, and dental office management programs. If you can identify a problem that a computer can solve or simplify, you have an idea for a computer program.
You must know exactly what you want your program to do before you start designing and writing it. One of the most common reasons programs fail is because the program doesn’t solve the right problem that people really need.
THE FBI’S $170 MILLION FLOP
The Federal Bureau of Investigation (FBI) had a problem. It had so much information, stored on paper, scattered among so many agents around the country that finding and using this information was nearly impossible. One agent might have vital information that could help a second agent crack a case, but unless those two agents knew what each other had, that information might as well never have existed in the first place.
So, the FBI had a bright idea: Create a computer program that would allow agents to store and share information through the computer. Several years and $170 million later, the FBI had its program, dubbed Virtual Case File, which consisted of more than 700,000 lines of error-prone commands that never even worked. Rather than try to salvage the project, the FBI decided it was easier just to cancel the whole thing and basically flush 170 million taxpayer dollars down the drain.
What went wrong? Although many factors contributed to the project’s failure, one reason stands out in particular: According to an audit of the program conducted by the U.S. Department of Justice, a prime cause for failure was “poorly defined and slowly evolving design requirements.” In other words, the FBI never knew exactly what it wanted the program to do.
How can you aim at a target if you don’t know what it is? You can’t. Or you can try, just as long as you spend $170 million to discover that if you don’t know what you want, you’re probably never going to get it.
Defining the steps
After you know what you want your program to do, you need to define all the steps that tell the computer how to solve that particular problem. The exact