High-level language programs are usually written (coded) as ASCII text into a source code file. A unique file extension (Examples: .asm .cob .for .pas .c .cpp) is used to identify it as a source code file. As you can guess for our examples Assembly, COBOL, FORTRAN, Pascal, "C" and "C++" however, they are just ASCII text files (other text files usually use the extension of .txt). The source code produced by the programmer must be converted to an executable machine code file specifcally for the computer's CPU (usually an Intel or Intel compatible CPU within today's world of micro computers). There are several steps in getting a program from its source code stage to running the program on your computer. Historically, we had to use several software programs (a text editor, a compiler, a linker and operating system commands) to make the conversion and run our program. However, today all those software programs with their associated tasks have been integrated into one program usually called a compiler. However, this one compiler program is really many software items that create an environment used by programmers to develop software. Thus the name: Integrated Development Environment or IDE.
The following fgure shows the progression of activity in an IDE as a programmer enters the source code and then directs the IDE to compile and run the program.
Upon starting the IDE software the programmer usually indicates he wants to open a file for editing as source code. As they make changes they might either do a "save as" or "save". When they have fnished entering the source code, they usually direct the IDE to "compile & run" the program. The IDE does the following steps:
- If there are any unsaved changes to the source code file it has the test editor save the changes.
- The compiler opens the source code file and does its first step which is executing the pre-processorcompiler directives and other steps needed to get the file ready for the second step. The include will insert header files into the code at this point. If it encounters an error, it stops the process and returns the user to the source code file within the text editor with an error message. If no problems encountered it saves the source code to a temporary file called a translation unit.
- The compiler opens the translation unit file and does its second step which is converting the programming language code to machine instructions for the CPU, a data area and a list of items to be resolved by the linker. Any problems encounted (usually a syntax or violation of the programming language rules) stops the process and returns the user to the source code file within the text editor with an error message. If no problems encountered it saves the machine instructions, data area and linker resolution list as an object file.
- The linker opens the program object file and links it with the library object files as needed. Unless all linker items are resolved, the process stops and returns the user to the source code file within the text editor with an error message. If no problems encountered it saves the linked objects as an executable file.
- The IDE directs the operating system's program called the loader to load the executable file into the computer's memory and have the Central Processing Unit (CPU) start processing the instructions. As the user interacts with the program, entering his test data, he might discover that the outputs are not correct. These types of errors are called logic errors and would require him to return to the source code to change the algorithm.