How to be a Programmer | Part 3 : Basic Concepts of Programming

CtechF - Featured How to be a programmer part 3

How to be a Programmer (Part 3) – Translators and Problem Analyzing

A program written in any computer language except in machine language should be translated to machine language instruction before execution. Because program written in a high-level language cannot be understood by the Computer. The computer only understand machine code (binary).

Also read :

1) Programming Language Translators

There are several translation programs.

1.1) Assembler

An Assembler creates an object by translating Assembly instruction mnemonics into machine language

CtechF - assembler

1.2) A Compiler

A Compiler translates all statements completely written in high-level languages into machine language instructions before execution. But, if there are syntax errors in the program, it is not be translated to machine code.

CtechF - compiler

1.3) An Interpreter

This is the language which translates each statement written in a high-level computer language to machine command one by one and the translated program is executed using necessary commands instantly. After the program is translated to machine code once, it can execute any number of times. A translation is needed again only if the source code is changed.

CtechF - interpreter

2) Comparison of compiler and Interpreter

3) Analyzing a Problem

An Assembler creates an object by translating Assembly instruction mnemonics into machine language

CtechF - input,process,output

Example :

Problem 0: Making a cup of tea

Input: Tea, Leaves, sugar, hot water


  1. Putting tea leaves in the strainer.
  2. Pouring hot water to the cup through the strainer.
  3. Adding some sugar to the cup
  4. Stirring well with a spoon.
  5. Testing for taste, taking a small sip from the cup.
  6. If the taste is not satisfactory, go to step 3 and repeat step 4 and 5

Output: Cup of tea  

Problem 1: Adding two numbers

Input: Two numbers

Process: Adding the two numbers

Output: Total

Problem 2: Finding the larger number between two numbers

Input: Two numbers

Process: Computing the two numbers, finding the larger one

Output: Larger Number.

4) What are alternative solutions?

If there is more than one solution to a problem, such solutions are called alternative solutions.

Example: The solution space to find the perimeter of a rectangle.

Input: Length and width of the rectangle

Process: Calculate the perimeter

  • 1st solution – Perimeter = length + width + length + width
  • 2nd solution – perimeter = length x 2 + width x 2
  • 3rd solution – perimeter = (length + width) x 2

Output: Perimeter

Related posts:


Leave a Reply