Choosing a compiler and interpreter
Using a virtual machine
Editors, debuggers, toolkits, and profilers
Help file creators
Installers and disassemblers
The two most important tools a programmer needs are an editor and a compiler. An editor lets you type and save language commands (called the source code) in a plain text file. (Unlike a word processor file, a text file doesn’t contain any formatting, like italics or fonts.) A compiler converts your source code into machine code and stores those machine code commands in a separate file (often called an executable file). After you store your program in an executable file, you can sell and distribute that executable file to others.
An editor and a compiler are absolutely necessary to write and distribute programs. However, most programmers also use a variety of other tools to make programming easier. To help them track down problems (bugs) in a program, programmers use a special tool, a debugger. To help them identify which parts of a program may be making the entire program run too slow, programmers can use another tool, a profiler.
For distributing programs, programmers often use a help file creator and an installer program. The help file creator makes it easy for the programmer to create, organize, and display help that the user can read while using the program. The installer program makes it easy for users to copy all the necessary files on to their computer so the program runs correctly.
Finally, programmers may also use a special tool — a disassembler — which can pry open another program to reveal how it works. Disassemblers are often used by security professionals to analyze how viruses, worms, and spyware programs work. For less honorable uses, programmers can also use a disassembler to dissect a rival program and study how it works.
No two compilers work exactly alike, even compilers designed for the same language, such as two competing C++ compilers. It’s perfectly possible (and quite common) to write a program that works perfectly with one compiler but doesn’t run at all under another compiler without minor (or massive) changes.
When Microsoft wrote the Macintosh version of their Microsoft Office suite, they used CodeWarrior, which is a C++ compiler. Unfortunately, the CodeWarrior compiler ran only on the PowerPC processors, which were used in the older Macintosh computers. When Apple switched to Intel processors, Microsoft had to dump the CodeWarrior compiler and use a different compiler, Xcode.
Because CodeWarrior and Xcode are both C++ compilers, Microsoft could theoretically compile the same C++ program under both CodeWarrior and Xcode with no problems. Realistically, Microsoft had to rewrite major portions of their C++ programs just to get them to run under the Xcode compiler. So the moral of the story is that switching compilers is rarely an easy decision, so it’s important to choose the “right” compiler from the start.
When choosing a compiler, you have to consider your needs, the compiler company’s reputation, and the compiler’s technical features.
The most important choice for a compiler centers solely on what you need. Follow these steps:
1. Decide which programming language you want to use.
If you want to write C++ programs, you need a C++ compiler. If you want to write BASIC programs, you need a BASIC compiler.
2. Decide which operating system you want to use.
If you want to write C++ programs for the Mac OS X operating system, your choices immediately narrow down to the small list of C++ compilers that run under the Mac OS X operating system.
3. Choose a compiler that has the best chance of being around years from now.
• Most companies prefer using compilers from brand-name companies, like Intel or Microsoft.
• Many people are choosing “open source” compilers.
Open source simply means that the source code to the compiler is available freely to anyone. Not only does this mean that open source compilers are free (compared to the hundreds of dollars you can pay for a brand-name compiler from Intel or Microsoft), but open source also guarantees that the compiler can’t become obsolete due to lack of support.
Because anyone can examine and modify the source code to an open source compiler, anyone can make changes to the compiler to improve it. One of the most popular open source compilers is GCC (http://gcc.gnu.org), which stands for GNU Compiler Collection.
Originally, GCC only compiled C source code, but later versions of GCC now compile several different languages, including C, C++, Java, Ada, and Objective-C, with more programming languages being supported every day. Even better, the GCC compiler also runs on a variety of operating systems, such as Windows and Linux, so if you write a program using the GCC compiler, you can recompile your program to run under another operating system with minimal (hopefully) changes.
The front-end of the compiler translates source code into an intermediate format.
• To write C++ programs, you must use the C++ front-end of the GCC compiler.
• To write Ada programs, use the Ada front-end of the GCC compiler.
• By creating front-ends for different languages, programmers can make the GCC compiler compile more programming languages.
The back-end of the compiler finishes translating the intermediate code into actual machine code.
After you choose a particular programming language and pick which operating systems you want your programs to run on, your list of compiler choices is likely narrowed down to one or two choices. Given two compilers that both meet your needs, you can pick the “best” compiler by examining their technical features.
The compiler stops being developed and supported.
The compiler can’t run under the operating system or processor you need in the future.
A particular technical feature is something you don’t need or care about.
No two compilers are alike, even those that compile the same programming language, such as C++. The problem is that every programming language has an official “standard,” but the standard for most programming languages is usually far behind what people in the real world are actually using. (By the time an official standards committee agrees on the features of a given programming language, programmers have already created new features that eventually become standards in future versions of that language.)
As a result, most compilers support a given language standard plus additional features that programmers have developed. Therefore, every compiler actually works with a different dialect of a programming language. So C++ programs that run under the Microsoft Visual C++ compiler may or may not run the same when compiled under the GCC compiler, even though both compilers claim to support the “standard” C++ programming language.
Every compiler converts source code into machine language, but some compilers can translate source code into more efficient machine language commands than other compilers. As a result, it’s possible to compile the same C++ program under two different C++ compilers and create identically working programs that consist of different machine language instructions.
The goal of every compiler is to create a program that takes up as little memory and disk space as possible while running as fast as possible. Usually, compilers make a trade off. To make a program run faster, the executable file may take up a large amount of disk space or require a lot of memory. If the compiler can reduce the size of your program and the amount of memory it needs to run, it may create a slow program.
To help you tweak your program for the best balance of speed, size, and memory requirements, many compilers offer optimization settings. By fiddling with these optimization settings, you can tell the compiler how to speed up or shrink your program, as shown in Figure 4-1.
One major feature of a compiler’s code generation capabilities involves speed, which can measure two different features:
Speed can refer to how quickly the compiler works in translating your source code to machine code.
In the old days, compilers could take hours or days to compile a simple program. Nowadays, compilers often work in minutes or even seconds. Shove in a program that consists of 800,000 lines of code, and in less than a minute, the compiler can create an executable file for you. The faster the compiler works, the less time you waste running and testing your program.
The speed of a compiler can refer to the performance of the machine language code that the compiler creates.
Given the same program, one compiler may create a program that runs quickly whereas a second compiler may create that same program that runs much slower.
Most compilers can compile programs only for a specific operating system, such as Windows or Linux. However, what happens if you need to write a program that runs on two or more operating systems?
You could write the program twice with two different compilers — one for each operating system. So if you wanted to write a C++ program that runs under Windows and Mac OS X, you could compile that program by using Microsoft Visual C++ (for Windows) and then write a similar program to compile by using Xcode (for Mac OS X).
Of course, writing the same program two times for two different compilers on separate operating systems is a tremendous waste of time. As an alternative, some compilers are known as cross-compilers — they can create programs that work on multiple operating systems, such as Windows, Linux, and Mac OS X. Figure 4-2 shows the REALbasic cross-compiler, which lets you choose whether to compile a program for Windows, Linux, or Mac OS X.
With a cross-compiler, you can write a program once and compile it to run on multiple operating systems, effectively doubling or tripling your potential market. Without a cross-compiler, you need to write a program for each compiler, under a different operating system, essentially doubling or tripling your work.
Paying more for a compiler doesn’t necessarily mean you’re getting a better compiler. The GCC compiler is free and is one of the best compilers available. Generally, if you want to use a popular programming language, such as C++, you can find a free compiler, but if you want to use a more obscure programming language, such as LISP or Modula-2, you’ll probably have to pay for a compiler.
Because Windows is the most common operating system in the world, you can find plenty of free compilers. Some of these compilers are free only for personal use, but if you want to create programs to sell commercially, you have to pay for the compiler. Table 4-1 lists some popular free Windows compilers.
Compiler Name | Programming Language | Where to Find It |
---|---|---|
GCC | C, C++, Objective-C, Java, | http://gcc.gnu.org |
FORTRAN, and Ada | ||
Visual Basic | BASIC | http://msdn.microsoft.com/vstudio/express |
Express 2005 | ||
Visual C# Express 2005 | C# | http://msdn.microsoft.com/vstudio/express |
Visual C++ | C++ | http://msdn.microsoft.com/vstudio/express |
Express 2005 | ||
Turbo C++ | C++ | www.turboexplorer.com |
Turbo C# | C# | www.turboexplorer.com |
Turbo Delphi | Pascal | www.turboexplorer.com |
Dev-C++ | C++ | www.bloodshed.net |
Dev-Pascal | Pascal | www.bloodshed.net |
Free Pascal | Pascal | www.freepascal.org |
Visual Prolog | Prolog | www.visual-prolog.com |
GNU Prolog | Prolog | http://gprolog.inria.fr |
The Mac OS X operating system is much less common than Windows, so you can choose from far fewer free compilers. However, Table 4-2 lists some Mac OS X compilers that you can use for free.
Compiler Name | Programming Language | Where to Find It |
---|---|---|
Xcode | C, C++, Objective-C | http://developer.apple.com/tools/xcode |
GNU Pascal | Pascal | www.gnu-pascal.de |
Free Pascal | Pascal | www.freepascal.org |
Because Linux is free, most Linux compilers are free as well. Table 4-3 lists some popular free Linux compilers. The REALbasic Linux compiler is free, but if you want REALbasic’s cross-compilation feature to develop programs for Windows and Mac OS X, you have to pay for the professional edition. Likewise, the Intel C++ and FORTRAN compilers are free only for non-commercial use. If you plan to develop commercial applications, you have to pay for the compiler.
Compiler Name | Programming Language | Where to Find It |
---|---|---|
GCC | C, C++, Objective-C, Java, | http://gcc.gnu.org |
FORTRAN, and Ada | ||
GNU Prolog | Prolog | http://gprolog.inria.fr. |
GNU Pascal | Pascal | www.gnu-pascal.de |
Free Pascal | Pascal | www.freepascal.org |
REALbasic | BASIC | www.realbasic.com |
Intel C++ | C++ | www.intel.com |
Intel FORTRAN | FORTRAN | www.intel.com |
Interpreters are commonly used for scripting languages, such as Perl or Python, but rarely used for systems programming languages, such as C++. That’s because if you write a program and use an interpreter, you must distribute a copy of your source code with the interpreter. Giving away your source code essentially gives away your program, so most commercial programs use a compiler instead.
In the old days, many companies sold language interpreters (the most popular were interpreters for running BASIC programs), but nowadays, most interpreters are given away for free as part of an operating system (such as Mac OS X) or another program (such as Microsoft Word). Interpreters for open source programming languages, such as Perl, Python, and Ruby, are also given away for free.
One of the most common uses for an interpreter is for creating short programs to automate another program, such as an operating system. The Mac OS X operating system includes an interpreter, dubbed Script Editor, for running programs with the AppleScript language. After you write a program (script) that’s particularly useful, you can even compile it into a standalone program, too.
Although Windows doesn’t include a similar macro language interpreter, you can visit Microsoft’s web site (www.microsoft.com/downloads) and download Microsoft PowerShell, a free interpreter.
PowerShell is designed for system administrators (people who need to control multiple computers, such as those connected to a network) to control and automate Windows. By writing simple programs in PowerShell, administrators can automate their routine tasks, such as starting or stopping a program, or moving files from one location to another.
PowerShell consists of simple commands (called command-lets or cmdlet) that perform a single task. By combining multiple cmdlets together where one cmdlet feeds data into another cmdlet, you can create more complicated programs.
Nearly every Web browser comes with a JavaScript interpreter. Web page designers use JavaScript for creating interactive Web pages, verifying information typed on a Web page (such as a username and password), or opening pop-up windows that display advertisements.
Although JavaScript interpreters can be found in any Web browser, you may have to download and install interpreters for other programming languages. Some popular programming languages for running programs on Web servers (those computers responsible for displaying and retrieving information from Web pages, such as shopping data) include
The preceding four languages not only have free interpreters that you can copy, but their interpreters also run on different operating systems. That means a Ruby or Perl program written on a Windows computer should run identically if copied and run on a Linux or Mac OS X computer.
A program run by an interpreter is almost always slower than the same program compiled into machine language, so why not compile every language rather than run them under an interpreter?
One of the reasons is that creating a compiler for multiple operating systems is much more difficult than creating an interpreter for multiple operating systems. To create a compiler, you need to know how to translate a programming language into machine code, but because operating systems can run under different processors (such as the PowerPC or Intel processors), you have to translate language commands into completely different machine language commands. Creating a compiler that works correctly for one processor is hard enough, but creating that same compiler to work under multiple processors identically and error-free is much more difficult.
Compiling a program into machine language is great when you want to distribute a program to others. However, languages like Ruby or Perl are often used to create short programs that run on a Web server. Using an interpreter may run a program slower, but you can write a program and run it right away without compiling it first. Also, by running the source code directly, interpreters let you see the source code of each program that’s running, so you can edit that source code and run it right away to see how your changes affect the program. You can still do this with a compiler, but having to compile a program and then store a separate executable version of that program is a minor annoyance that you can avoid completely just by using an interpreter.
Compilers are great for distributing programs.
Interpreters are much better for writing and running shorter programs when you don’t care whether anyone can see or copy the source code.
The problem with compilers is that they’re difficult to make for multiple operating systems and processors. The problem with interpreters is that they need the source code of a program to run, making interpreters unsuitable for distributing software. To solve both these problems, computer scientists created a third alternative — a virtual machine.
To protect the source code of a program, a virtual machine lets you compile your program into an intermediate file called bytecode or pseudocode (also known as p-code). To make a program run on multiple operating systems, you need a virtual machine that runs on each operating system, as shown in Figure 4-3.
The most popular programming language that uses a virtual machine is Java (http://java.sun.com), which was created by Sun Microsystems. The idea behind Java is to let you write a single program in Java, compile it into a bytecode file, and then distribute that bytecode file to any computer that has a Java virtual machine installed.
Theoretically, you can write a program once and make it run on Windows, Linux, and Mac OS X with no modifications whatsoever. Realistically, you may still need to tweak the program a bit to get it to run flawlessly on different operating systems, but that’s still much easier than writing a program from scratch for another operating system.
Although Java can run the same program on multiple operating systems, the virtual machine will never be as fast as a similar compiled program. As a result, Java programs can run sluggishly, especially on older computers.
Despite these drawbacks, Java has grown in popularity. Many companies write and sell programs entirely written in Java. As computers get faster and Sun Microsystems improves the performance of its virtual machine, programs written in Java probably will run fast enough for most uses.
To write programs, you need an editor, which acts like a special word processor just for helping you write commands in your favorite programming language. After you type your program commands in an editor, you can save this file (known as the source code). Then, you can feed this source code file into a compiler to turn it into a working program.
You can choose from two types of editors. Your best bet probably depends on whether you write programs in more than one programming language.
A standalone editor is nothing more than a separate program that you run when you want to edit your program. You run the compiler separately.
You can buy standalone editors, but here are two popular free ones. Both of these editors run on multiple operating systems (such as Windows and Linux):
GNU Emacs ( www.gnu.org/software/emacs/emacs.html
VIM ( www.vim.org
An integrated development environment (IDE) combines an editor with a compiler in a single program so you can easily edit a program and compile it right away. An IDE gives you access to these features within a consistent user interface, as shown in Figure 4-4.
Features
In addition to a compiler and all the usual features of standalone editors (as listed in the sidebar, “Common editor features”), many IDEs include other features in a convenient user interface:
Debugger helps identify problems in your program.
File management helps organize the source code for your various projects.
Profiler helps identify which parts of your program may be slowing down the performance of your entire program.
GUI designer helps you design the appearance of your program’s windows, pull-down menus, and buttons.
Free software
Many compilers come with their own IDE, but you can always use another IDE or a standalone editor instead. These IDEs are popular (and free):
NetBeans: www.netbeans.org
Designed for writing Java programs but can also be used for writing C/C++ programs as well. Available for multiple operating systems.
Eclipse: www.eclipse.org
Designed for writing Java programs, but can also be used for writing C/C++, PHP, and even COBOL programs as well. Available for multiple operating systems.
SharpDevelop: www.icsharpcode.net
A Windows-only IDE designed for writing C# and Visual Basic.NET programs.
Whether you prefer a standalone editor or an integrated development environment (IDE), most editors offer the following features:
Multiple undo/redo commands let you experiment with making changes to your source code. If they don’t work out, you can “undo” your changes.
Typically, editors let you undo a large number of changes you made, such as the last 100 changes.
Multiple file editing comes in handy so you can view different files in separate windows and copy code from one window to another, or just study how one part of your program will interact with another part of that same program.
Syntax completion and highlighting is when the editor recognizes certain programming languages, such as C++ and Java. The moment you type a valid language command, the editor can finish typing that command for you at the touch of a button, thereby, saving you time. So if you type a typical IF-THEN statement, the editor automatically types in a generic IF-THEN statement (complete with necessary parentheses), so you just type in the actual data to use.
Syntax highlighting occurs after you write a program; the editor highlights valid language commands to help you separate language commands from any data and commands you create. Without syntax highlighting, source code can look like a mass of text. With syntax highlighting, source code can be easier to read and understand.
Macros let you customize the editor and essentially program the editor to repeat commonly needed tasks, such as always displaying program commands in uppercase letters.
If the editor doesn’t offer a feature you want or need, its macro language lets you add that feature in. Without a macro language, an editor won’t give you the flexibility to work the way you want.
Project management helps you keep your source code files organized. Most programs no longer consist of a single file, but of multiple files. Trying to keep track of which files belong to which project can be confusing, so an editor can help you store and organize your files so you won’t lose track of them.
Eventually, everyone makes a mistake writing a program. That mistake could be as simple as typing a command wrong or forgetting a closing parenthesis, or it can be as complicated as an algorithm that works perfectly except when receiving certain data. Because writing error-free programs is nearly impossible, most programmers use a special tool — a debugger.
Two common debugger features include
Tracing or stepping
Variable watching
Some bugs are just annoying, such as the wrong color on a pull-down menu.
Some bugs are critical, such as a bug that adds two numbers wrong in an accounting program.
Any bug that keeps a program from running correctly is a show stopper.
Stepping (or tracing) lets you run your program, line by line, so you can see exactly what the program is doing at any given time. The second you see your program doing something wrong, you also see the exact command in your program that caused that problem. Then you can fix the problem, as shown in Figure 4-5.
Here are the two types of debuggers:
Source-level: Lets you examine your source code line by line. So if you write a program in BASIC, a source-level debugger shows you each line of your entire BASIC program.
Machine-language: Lets you examine the machine language code, line by line, that your compiler created from your source code. Programmers often use machine-language debuggers to examine programs when they don’t have access to the source code, such as a computer virus or a rival’s program.
Stepping line by line through a small program may be feasible, but in a large program that consists of a million lines of code, stepping line by line would take far too long. So to make stepping easier, most debuggers include breakpoints and stepping over/stepping out commands.
A breakpoint lets you skip over the parts of your program that you already know work. So if you have a program that’s 10,000 lines long and you know the problem is somewhere in the last 1,000 lines of code, there’s no point stepping through those first 9,000 lines of code.
A breakpoint lets you tell the computer, “Skip from the beginning of the program to the breakpoint and then step through the rest of the program line by line.” Figure 4-6 shows how you can highlight a line with a breakpoint. That way your program runs from the beginning to the first breakpoint. After your program stops at a breakpoint, you can step through the rest of your program line by line.
The stepping over and stepping out commands are used to debug a large program that consists of multiple subprograms. Normally, stepping would force you to examine every subprogram, line by line. However, what if you know the problem isn’t in a specific subprogram?
By using the step over and step out commands, you can avoid stepping through lines of code stored in a subprogram.
Step over
To avoid stepping through every subprogram, debuggers let you use the step over command. This tells the computer, “See that entire subprogram? Treat it as a single command and don’t bother stepping through it line by line.” Figure 4-7 shows how the step over command works.
The step over command lets you completely skip over any lines of code stored inside of a subprogram.
Step out
Suppose you start examining a subprogram line by line and suddenly want to stop. As an alternative to stepping through the rest of the subprogram, you can use the step out command, which tells the computer, “Stop stepping through the subprogram line by line right now!”
When you step or trace through a program, line by line, you can see how the program works. For more insight into your program’s behavior, you can watch your variables.
Watching a variable lets you see what data your program is storing and using at any given time. That way if your program is supposed to print a name but actually prints that person’s phone number, you can step through your program line by line, and watch to see which line stores the wrong data for the program to print.
Not only can you “watch” how your program stores data, but a debugger also lets you change data while your program is running. By changing data, you can see how your program responds.
For example, suppose a program asks the user to type in his age. If you run your program and type in a valid age, such as 15, you can see how your program handles the number 15. But what happens if the user types in an invalid number, such as 0 or -17?
A good programmer always makes sure the program doesn’t accept invalid data, but suppose part of your program changes the age data by mistake. Depending on the age, sometimes the program changes the age to 0, sometimes it changes it to a negative number (-12), sometimes it changes it to an outrageously large number (486).
To find out how and why your program seems to randomly change the age, you can step through your program and watch the number stored as the age. By changing your variable while the program is running, you can type in different age values to see how your program responds.
By doing this, you can suddenly see that any time the age is less than 5, your program turns the age into 0; any time the age is greater than 5 but less than 45, the program turns the age into a negative number; and any time the age is greater than 45, the program turns the age into a huge number, like 486.
Without the ability to change the value of the age variable while the program is running, debugging a program is much slower and more tedious. By changing the value of the age variable while the program is running, you can test different values without having to trace through the program multiple times using different values. Just run the program once and change the value of the age variable as many times as you want, as shown in Figure 4-8.
Programmers are naturally lazy and often look for the simplest way to solve any problem. So when faced with creating a program, programmers prefer to cheat by using third-party components, which are programs that somebody else has created already (and hopefully tested).
Third-party components usually offer commonly needed features, such as a word processor, a spreadsheet, or a database, that you can plug into your own program. So instead of having to write your own word processor, you can buy a word processor component and plug it into your own program; now your program has word processing capabilities with little additional programming on your part.
Depending on the features, third-party components can range in cost from a few hundred dollars to a few thousand dollars or more. Most third-party components aren’t cheap, but because they can save you a lot of time, they may be worth the price.
Not all parts of a program are equal. Some parts of a program may only run once or twice, whereas other parts of a program may run hundreds or even thousands of times. For example, suppose you have a program that stores names and addresses. To use this program, you must first type in your name and password before you can sort and search through the program’s list of names and addresses.
In this example, the part of the program that asks for a username and password runs only once, but the part of the program that searches and sorts through your list of names and addresses may run multiple times. So which part of your program determines its speed? The part that runs once (asking for a username and password) or the part that runs multiple times (searching and sorting names and addresses)?
Obviously, if you want to speed up your program, you’d focus on the part that runs most often, and that’s what a profiler does. A profiler examines your program and identifies the most frequently used parts of that program. After you know which parts of your program run most often, you can work on making that part of the program run faster, a process known as optimizing.
Profilers typically use two methods for examining a program:
Sampling: This examines your entire program at fixed time intervals. Through sampling, a profiler can get a rough estimate on which parts of your program (often referred to as hot spots) are being run most often.
Instrumentation mode: After you use sampling to identify hot spots, you can use this mode to examine the program in more detail to determine exactly what each program line does.
By identifying the hot spots, you can speed up your entire program by rewriting or optimizing those frequently run parts of the program.
Hardly anyone reads software manuals, so when people need help, they typically turn to the program’s help file for answers. This help file is essentially the software manual organized as miniature Web pages that you can view and click to see similar (linked) information, as shown in Figure 4-9.
Almost every program has a help file, but creating a help file can be tedious and time-consuming. So to simplify this process, many programmers use special help file creation programs.
Just as a word processor makes it easy to write, edit, and format text, help file creators make it easy to write, edit, organize, and link text together to create a help file.
Before anyone can use your program, they need to install it. Because programs can consist of dozens of separate files, most programs use a special installation program that makes sure all necessary files are copied on to a user’s computer.
To use an installation program, identify all the files that make up your program and where to store them — either in a single location (folder) or scattered in multiple locations (folders).
Although the main purpose of an installer is to make sure all program files get copied to the user’s hard disk, installers often give you the option of displaying graphics or playing music while your program installs on the user’s computer. You can specify which graphic and audio files to display and play as well as how long to display and play them, as shown in Figure 4-10.
A disassembler acts like a reverse compiler. A compiler converts your program (written in any programming language, such as C++ or Pascal) into machine language, a disassembler takes an executable file (which contains machine language code) and converts it into assembly language.
Disassemblers have both honorable and shady uses. On the honorable side, antivirus companies use disassemblers to dissect how the latest viruses, worms, and Trojan Horses work. After they know how these nasty programs work, they can figure out how to detect, stop, and remove these malicious programs.
On the shady side, many companies use disassemblers to tear apart their rival’s products and see how they work. After you know how a competitor’s program works, you can copy those features and use them in your own program.
Programming languages, such as Java, C#, and Visual Basic.NET, get compiled into bytecode format; therefore, a disassembler can reverse compile a bytecode file into its original source code. So, if you compile a Java program into bytecode format, a Java disassembler can convert the bytecode file into Java source code. Likewise, if you compile a C# or Visual Basic.NET program, you can disassemble that bytecode file into its original C# or Visual Basic.NET source code.
To protect their bytecode files from disassemblers, programmers use another program — an obfuscator. An obfuscator essentially scrambles a bytecode file. The bytecode file can still run, but if others try to disassemble an obfuscated bytecode file, they can’t retrieve the original source code.
At the bare minimum, all you need is an editor (to write programs) and a compiler (to convert your programs into executable files). However, most programmers use a debugger, a help file creation program, and an installer. Although most programmers are happy when they can get their program to work, some programmers use a profiler to help them speed up and optimize their program.
Finally, some programmers use disassemblers to peek inside the inner workings of other programs, such as viruses or rival software. Disassemblers are never necessary for creating a program, but they can prove useful for legal and not so legal purposes.
The tools of a programmer are highly subjective. Some programmers swear by certain tools, such as their favorite editor or compiler, whereas others are happily with whatever tool is available. Just remember that programmer tools can help you write faster and more reliable programs, but the best tool in the world can never substitute for decent programming skill in the first place.