How programs are technically written - PROGRAMMING FOR BEGINNERS: All Concepts Explained (2016)

PROGRAMMING FOR BEGINNERS: All Concepts Explained (2016)

4. How programs are technically written

When writing (i.e. creating) program, it is necessary to follow three basic steps to create a working program. But these steps can also contain other optional steps into themselves, as you'll see. You can read about these three steps in the following sections.

4.1 Step 1: writing program instructions in source code file

Source code is a plain text file in which program instructions are typed and saved by programmer. Initially, programmer writes program in source code text file. Programmer writes instructions following programming language's rules and tries not to make mistakes in code, because in the case of even single syntax error, program would not compile or run. Generally, there are some coding conventions that are recommended to follow, but main idea is to write code without syntax errors or it would not compile or run. Because programs are written and saved as just plain text files, you can use any plain text editor software to write programs, although probably easier alternative would be to use source code editor program for specific programming language. Source code editors have syntax highlighting feature which highlights different code parts with different color and makes reading code easier. Source code editors also help programmers write organized code for easy future reading.

4.2 Step 2: Compiling and/or linking source code to create program or using interpreter to run source code without compilation

After you create program source code, the next step is to compile or run program. This step is obviously most important because you want to check if source code (i.e. program) written by you works correctly and if it has any errors. You would not know if program can run or not until you compile or run (in case of program written in interpreted programming language). When you try to compile source code, it checks for errors and warns you to correct errors, because with even single error program can not be compiled. Programmers compile and run programs quite often while developing, to make sure program can be compiled and that it runs.

4.3 Step 3: if errors are found in Step 2, correct errors. If no errors are found, then program is successfully built and ready to use

Step 3 is to simply correct errors if found in Step 2. Programming errors are very common. Even experienced programmers sometimes make programming mistakes. In this step, special error correction activity called debugging can also be done. Debugging is an process of running program in debug mode, in which programmer watches and inspects how various parts of program work, and also inspects in what condition is program while executing any specific instruction from the list of all program instructions. This helps programmers correct errors more thoughtful and fundamental way. Debugging is typically done when complete program has been written and programmer wants to correct final errors. When all error are fixed, program is ready for use.