Jan. 24, 2011, 5:34 p.m.
posted by berg
Choosing a Language
As you might have surmised at this point, computer programming is not as hard as it's cracked up to be. If you're comfortable enough with a computer to prepare a nice-looking resume, balance a checkbook with software such as Intuit Quicken, or create your own home page on the Web, you can write programs.
The key to learning how to program is to start with the right language. The programming language you choose often depends on the tasks you want the computer to accomplish. Each language has things it is well-suited for as well as things that are difficult—perhaps impossible—to do with the language. For example, many people use some form of the BASIC language when they are learning how to program because BASIC was created with beginners in mind.
Microsoft Visual Basic combines the ease of BASIC with some powerful features to aid in the design of Windows software. (VBScript, which is short for Visual Basic Script, offers the simplicity of BASIC for small programs that run in conjunction with World Wide Web pages.) Visual Basic has been used to write thousands of sophisticated programs for commercial, business, and personal use. However, Visual Basic programs can be slower than Windows programs written in other languages such as Borland C++. This difference is especially noticeable in programs that use a lot of graphics—games, screen savers, and the like.
This book covers the Java programming language, which was developed by Sun Microsystems. Though Java is more difficult to learn than a language such as Visual Basic, it is a good starting place for several reasons. One advantage of learning Java is that you can use it on the World Wide Web. If you're an experienced web surfer, you have seen numerous Java programs in action. They can be used to create chat rooms, play games, and help in other interactive efforts.
Another important advantage is that Java requires an organized approach for getting programs to work. The language is very particular about the way programs must be written, and it balks if programmers do not follow all of its rules.
When you start writing Java programs, you might not see the language's choosy behavior as an advantage. You'll write a program and have several errors to fix before the program is finished. Some of your fixes might not be correct, and they will have to be redone. If you don't structure a program correctly as you are writing it, errors will result.
In the coming hours, you'll learn about these rules and the pitfalls to avoid. The positive side of this extra effort is that your programs will be more reliable, useful, and error-free.
Java was invented by Sun Microsystems developer James Gosling as a better way to create computer programs. Gosling was unhappy with the way that the C++ programming language was working on a project he was doing, so he created a new language that did the job better. It's a matter of contentious debate whether Java is superior to other programming languages, of course, but the amount of attention paid to the language today shows that it has a large number of adherents. Book publishers obviously dig it—more than 1,000 books have been published about the language since its introduction. (This is my thirteenth, and I will keep writing more of them until prohibited by municipal, state, or federal law.)
Regardless of whether Java is the best language, it definitely is a great language to learn today. There are numerous resources for Java programmers on the Web, Java job openings fill the classified ads in many cities, and the language has become a major part of the Internet's past, present, and future. You'll get a chance to try out Java during Hour 2, "Writing Your First Program."
Learning Java or any other programming language makes it much easier to learn subsequent languages. Many languages are similar to each other, so you won't be starting from scratch when you dive into a new one. For instance, many C++ programmers find it fairly easy to learn Java, because Java borrows a lot of its structure and ideas from C++. Many programmers are comfortable using several different languages and will learn new ones as needed.