Sunday, June 14, 2009

What is Programming?

Programming:-

• A programming language is an artificial language that can be used to control the behavior of a computer.
• Source code is any series of statements written in a programming language.
• Computer programming (often shortened to programming or coding) is the process of writing, testing, and maintaining the source code of computer programs.

Computer Programs

• Source code cannot be directly understood by a computer, and hence must be converted into a
computer-executable form before it can run.
• The source code is either converted into an executable file (compilation), or executed on the
fly (interpretation).
• The term computer program may refer to source code, written in a programming language, or to the executable form of this code.

Compilers and Interpreters

• Computers cannot directly understand Source code. Computers understand their own language known as Machine Language or Machine Code. Different computer platforms have different Machine Languages. – For example, each of Microsoft Windows on Intel Pentium
Architecture and Mac OS X on Apple Macintosh Architecture would not “understand” the others machine code.
• Hence, a programming language’s source code needs to be converted into Machine Code before it can be used to control the behaviour of a computer.
• This conversion is done either by a compiler or an interpreter.

Compilers

• Compiler is a computer program that converts programmer friendly symbols in to machine friendly instructions.
• Compilers are often used to convert source code into machine code.
• Compilers convert the entire source code into machine code at one go. The machine code is executed only once all the source code has been converted.
• Since, different computer platforms have different machine languages, source code compiled into machine code for one architecture might not run on another.

Interpreters

• Interpreters differ from Compilers in that they never convert the whole source code
at one go.
• An interpreter usually converts one source code statement, executes the resulting machine code and then converts the next source code statement and so on.

Steps in writing a program

• There are four general phases during the development of any computer program

– Specify the problem
– Analyze and break down into a series of steps towards solution
– Write the code
– Compile, test and run the program


No comments: