What Is Programming?
Programming is a very natural and intuitive concept. A program is nothing
more than a series of statements written in a specific language. Programs are
everywhere, and even the technophobes of the world use programs every day.
Driving directions, cooking recipes, football plays, and DNA are all types of
programs. A typical program for driving directions might look something
like this Anyone who knows English can understand and follow these driving
directions, since they’re written in English. Granted, they’re not eloquent,
but each instruction is clear and easy to understand, at least for someone
who reads English.
Programming 7
But a computer doesn’t natively understand English; it only understands
machine language. To instruct a computer to do something, the instructions
must be written in its language. However, machine language is arcane and
difficult to work with—it consists of raw bits and bytes, and it differs from
architecture to architecture. To write a program in machine language for an
Intel x86 processor, you would have to figure out the value associated with
each instruction, how each instruction interacts, and myriad low-level details.
Programming like this is painstaking and cumbersome, and it is certainly not
intuitive.
What’s needed to overcome the complication of writing machine language
is a translator. An assembler is one form of machine-language translator—it is
a program that translates assembly language into machine-readable code.
Assembly language is less cryptic than machine language, since it uses names
for the different instructions and variables, instead of just using numbers.
However, assembly language is still far from intuitive. The instruction names
are very esoteric, and the language is architecture specific. Just as machine
language for Intel x86 processors is different from machine language for
Sparc processors, x86 assembly language is different from Sparc assembly
language. Any program written using assembly language for one processor’s
architecture will not work on another processor’s architecture. If a program
is written in x86 assembly language, it must be rewritten to run on Sparc
architecture. In addition, in order to write an effective program in assembly
language, you must still know many low-level details of the processor architecture
you are writing for.
These problems can be mitigated by yet another form of translator called
a compiler. A compiler converts a high-level language into machine language.
High-level languages are much more intuitive than assembly language and
can be converted into many different types of machine language for different
processor architectures. This means that if a program is written in a highlevel
language, the program only needs to be written once; the same piece of
program code can be compiled into machine language for various specific
architectures. C, C++, and Fortran are all examples of high-level languages.
A program written in a high-level language is much more readable and
English-like than assembly language or machine language, but it still must
follow very strict rules about how the instructions are worded, or the compiler
won’t be able to understand it.
Programming is a very natural and intuitive concept. A program is nothing
more than a series of statements written in a specific language. Programs are
everywhere, and even the technophobes of the world use programs every day.
Driving directions, cooking recipes, football plays, and DNA are all types of
programs. A typical program for driving directions might look something
like this Anyone who knows English can understand and follow these driving
directions, since they’re written in English. Granted, they’re not eloquent,
but each instruction is clear and easy to understand, at least for someone
who reads English.
Programming 7
But a computer doesn’t natively understand English; it only understands
machine language. To instruct a computer to do something, the instructions
must be written in its language. However, machine language is arcane and
difficult to work with—it consists of raw bits and bytes, and it differs from
architecture to architecture. To write a program in machine language for an
Intel x86 processor, you would have to figure out the value associated with
each instruction, how each instruction interacts, and myriad low-level details.
Programming like this is painstaking and cumbersome, and it is certainly not
intuitive.
What’s needed to overcome the complication of writing machine language
is a translator. An assembler is one form of machine-language translator—it is
a program that translates assembly language into machine-readable code.
Assembly language is less cryptic than machine language, since it uses names
for the different instructions and variables, instead of just using numbers.
However, assembly language is still far from intuitive. The instruction names
are very esoteric, and the language is architecture specific. Just as machine
language for Intel x86 processors is different from machine language for
Sparc processors, x86 assembly language is different from Sparc assembly
language. Any program written using assembly language for one processor’s
architecture will not work on another processor’s architecture. If a program
is written in x86 assembly language, it must be rewritten to run on Sparc
architecture. In addition, in order to write an effective program in assembly
language, you must still know many low-level details of the processor architecture
you are writing for.
These problems can be mitigated by yet another form of translator called
a compiler. A compiler converts a high-level language into machine language.
High-level languages are much more intuitive than assembly language and
can be converted into many different types of machine language for different
processor architectures. This means that if a program is written in a highlevel
language, the program only needs to be written once; the same piece of
program code can be compiled into machine language for various specific
architectures. C, C++, and Fortran are all examples of high-level languages.
A program written in a high-level language is much more readable and
English-like than assembly language or machine language, but it still must
follow very strict rules about how the instructions are worded, or the compiler
won’t be able to understand it.
0 comments:
Post a Comment