Compare the Difference Between Similar Terms

Difference Between Source Program and Object Program

The key difference between Source Program and Object Program is that Source program is a human-readable program written by a programmer while object program is a machine executable program created by compiling a source program.

Source programs can be either compiled or interpreted for execution. Decompilers helps to convert object programs back to its original source programs. It is important to note that the terms source program and object program are used as relative terms. If you take a program transformation program (like a compiler), what goes in is a source program and what comes out is an object program. Therefore, an object program produced by one tool can become a source file for another tool.

CONTENTS

1. Overview and Key Difference
2. What is Source Program
3. What is Object Program
4. Side by Side Comparison – Source Program vs Object Program in Tabular Form
5. Summary

What is Source Program?

The programmer writes the source program using higher level language. Therefore, it is easily readable by the humans. Source programs usually contain meaningful variable names and helpful comments to make it more readable. A machine cannot directly execute a source program. A compiler helps to transform source program to executable code to execute by the machine. Alternatively, is to use an interpreter. It executes a source program line by line without pre-compilation.

Figure 01: A Source Program

Visual Basic is an example of a compiled language, while Java is an example of an interpreted language. Visual Basic source files (.vb files) are compiled to .exe code, while Java source files (.java files) are first compiled (using javac command) to bytecode (an object code contained in .class files) and then interpreted using the java interpreter (using java command). When software applications are distributed, typically they will not include source files. However, if the application is open source, the source is also distributed and the user gets to see and modify the source code as well.

What is Object Program?

Object program is usually a machine executable file, which is the result of compiling a source file using a compiler. Apart from machine instructions, they may include debugging information, symbols, stack information, relocation, and profiling information. Since they contain instructions in machine code, they are not easily readable by humans. But sometimes, object programs refer to an intermediate object between source and executable files.

Tools known as linkers helps to link a set of objects into an executable (e.g. C language). As mentioned above .exe files and bytecode files are object files produced when using Visual Basic and Java respectively. The .exe files directly execute on windows platform while bytecode files need an interpreter for execution.

Most software applications are distributed with the object or executable files only. It is possible to convert the object or executable files back to its original source files by decompilation. For example, the decompiler tools can decompile java.class files(bytecode) in to its original .java files.

What is the Difference Between Source Program and Object Program?

Source program is a human readable program written by a programmer. It is written in higher level languages such as Java or C. Therefore, a source program is human readable. It is not understandable by the machine.

On the other hand, Object program is a machine executable program created after compiling a source program. It contains lower level languages such as assembly or machine code. Therefore, the object program is not readable by the human. It is understandable by the machine.

Summary – Source Program vs Object Program

The difference between Source Program and Object Program is that Source program is a human readable program written by a programmer while object program is a machine executable program created by compiling a source program.

Reference:

1.“Source Code.” Wikipedia, Wikimedia Foundation, 17 May 2018. Available here

2.“Object Code.” Wikipedia, Wikimedia Foundation, 14 May 2018. Available here 

Image Courtesy:

1.’CodeCmmt002’By Dreftymac (CCBY 2.5) via Commons Wikimedia