A program is a set of instructions or commands to be executed by the computer to accomplish some task. A program involves code for solving a problem and also good documentation which would be a guideline to anyone who tries to understand the program.
An algorithm is a formula, a method, a recipe, a step by step procedure to be followed in order to obtain the solution to a problem.
Conversion of an algorithm to a program in a programming language following the syntax and semantics of that language is defined as a code.
Syntax is the correct method or grammar of writing a command or series of commands which are pre-defines by that particular programming language. Semantics is the logical meaning of a program or series of commands, separate from the grammatical structure. The computer detects syntax errors but does not detect logical errors.
What are the Criteria for a good program?
- It should be correct i.e. output should be as per the specifications
- It should be reliable; it should function accurately for a long period of time and also function correctly over all ranges and combination of data.
- It should be robust; unwanted inputs or data should be identified and proper error message should be flashed. It should never crash.
- It should be user friendly with enough comments, tips, on-line help and short cut options.
- It should be efficient, with minimum memory and quality output in acceptable time span.
- It should be readable i.e. it should be simple so that it can be understood to make changes and enhance it if required.
- It should be portable so that program can be executed on different machines and environment.
- It should follow all standards and have proper documentation.