Заочное дистанционное образование
с получением государственного
диплома Московского государственного индустриального
университета (МГИУ) через Internet
  Главная  Карта сайта  Новости  Об авторе  Контакты

 
 
 
 
 
  Reasons for studying accounting  
  Accounting  
  The Nature and Purpose of Accounting  
  Accounting terminology  
  Types of Accounting Careers  
  The Balance Sheet  
  How to talk about money?  
  Financial management  
  The Double-entry System  
  A model of the economy  
  Accounting concepts  
  Economic notions: Money, Price, Cost  
  The Economy of Great Britain  
  The Economy of the USA  
  Techniques of Financial Analysis  
  Marketing  
  Taxation  
  The Cell Phone Age  
  Programming languages  
  Functions of computers  
  History of robotics  
  Personal finance  
  Common Job Interview Questions  
  International Trade  
  Time issues  
  10 Social Media Mistakes Small Businesses Can Avoid  
  Academic terms from Russian to English  
 
 
 
 
 
 

 

Programming languages

Рассылки Subscribe.Ru
Современное образование
Подписаться письмом

        Our most fundamental tool as intelligent beings is language. It is through language that you learn new information and share your knowledge, feelings, and experiences with others. Through language, you can express any thought anyone has ever had and describe any event, real or fictional. The world is controlled through language. Presidents to petty functionaries, generals to Gis, CEOs to clerks-all rely on language to give instructions to others and to gather information.
Language is a necessity for a computer, too. Software is created using special languages that provide instructions for telling the computer what to do. And language defines the data with which the instructions will work.
Computer language is similar to human language in many ways. The nouns, verbs, prepositions, and objects found in English, for example, have their counterparts in programming code-or the source code, the actual lines of text
that get translated into functioning programs. But software sentences have their own syntax, and the words that make up the languages have their own precise meanings.
Computer language is more exacting and more limited than English. An often-repeated story tells how, in an early attempt to use a computer to translate English into Russian, the phrase "The spirit is willing, but the flesh is weak" was interpreted as "The vodka is ready, but the meat is rotten." The story might be mythical, but it illustrates a reality-that computers and their languages do not do a good job of managing the ambiguities and shades of meaning in human language that any four-year-old understands (although advances in voice recognition have computers understanding what we say, if not what we mean).
If programming languages lack the subtleties of human language, human language cannot match the precision of computer-speak. Try, for example, to describe a simple spiral without using your hands. It's impossible in English. But because math is an integral part of computer languages, those languages cannot only describe a spiral but also can provide the instructions to create an image of that spiral on a display or printer.
 
Different Programming Languages
Just as there is more than one language for humans, so is there more than one computer language, even for the same type of computer. Generally, the various languages are described as low-level or high-level. The more a computer language resembles ordinary English, the higher its level. Lower-level languages are more difficult to work with, but they usually produce programs that are smaller and faster.
On the lowest level is machine language. This is a series of codes, represented by numbers (ones and zeros), used to communicate directly with the internal instructions of the PC's microprocessor. Deciphering machine language code or writing it is as complex a task as one can tackle in computing. Luckily, we don't have to do it. Programs called interpreters and compilers translate commands written in higher-level languages into machine language. We'll look at both interpreters and compilers later in this chapter.
On a slightly higher level than machine language is assembly language, or simply assembly, which uses simple command words to supply step-by-step instructions for the processor to carry out. Assembly language directly manipulates the values contained in those memory scratch pads in the microprocessor called registers. In machine language, the hexadecimal code 40 increases by one the value contained in the register named AX; assembly language uses the command INC AX to perform the same function. Although assembly language is more intelligible to humans than machine language codes, assembly is still more difficult to use than higher-level languages. Assembly remains popular among programmers, however, because it creates compact, fast code.
On the high end, languages such as C and Java allow programmers to write in words and terms that more closely parallel English. And the programmer using these languages need not be concerned with such minutiae as registers. The C language is powerful and yet reasonably simple to write and understand. Currently, Java is the rising star among languages because a program written in Java will run on any computer no matter what its operating system. This is a distinct advantage when you're writing programs people will use over the Internet, using anything from PCs to Macs and Sun workstations. Software written in C, in contrast, must be modified to allow a program written for one type of computer to be used on another.
At the highest level are languages such as BASIC (Beginners All-purpose Symbolic Instruction Code), Visual Basic, the DOS batch language, and the macro languages used to automate applications such as Microsoft Office and Corel WordPerfect Office.
 
Software Construction
A program can be a single file – a record of data or program code saved to a disk drive. But generally, complex software consists of one file that contains a master program – the kernel – surrounded by a collection of files that contain subprograms, or routines. The kernel calls the routines it needs to perform some task, such as display a dialog box or open a file. A routine can also call other routines in the same file, in another file that's part of the program, or in files provided by Windows for common functions. Together, the kernel and subprograms give programs a way to receive, or input, information from the keyboard, memory, ports, and files, rules for handling that input data, and a way to send, or output, information to the screen, memory, ports, and files.
Typically, when a user types information into a program, it is stored as a variable. As the term suggests, the information a variable stores varies from one instance to another. Programs on their own are also capable of storing in variables the information based on the results of a calculation or manipulation of data. For example, to assign the value 3 to a variable X, BASIC uses the command X = 3. Assembly language accomplishes the same thing by assigning the value to the AX register with the command MOV AX,3. Some languages require several commands to achieve the same effect another language accomplishes with a single command.
After a program has information in a variable, it can manipulate it with commands that perform mathematical operations on numbers or parse text strings. Parsing is the joining, deletion, or extraction of some of the text characters to use them elsewhere in the program. When a variable is text, it is often called a string. You can have math strings, but most often, the term string refers to an uninterrupted series of alphanumeric and punctuation characters. Through parsing, a program can locate, for example, the spaces in the name "Phineas T. Fogg"; determine which parts of the string make up the first name, the middle initial, and the last name; and assign each segment to a separate variable. A typical math manipulation would be X = 2 + 2, which results in the variable X having the value 4. If that command is then followed by X = X + 1, the new value of X would be 5. The command X = "New" + " " + "York" assigns the string "New York" to variable X.
Programs can rely on the BIOS to perform many of the input and output functions-such as recognizing keystrokes, displaying keystrokes onscreen, sending data through the parallel and serial ports, reading and writing to RAM, and reading and writing disk files. The programming language still must have commands to trigger the BIOS services. Consider the follow series of BASIC commands:
OPEN "FOO" FOR OUTPUT AS #1
WRITE #1, "This is some text."
CLOSE #1
 
These commands create a file named FOO that contains the text in quotes: This is some text. It then closes the file. The language Pascal does the same with these commands:
Assign (TextVariable, "FOO");
Wri teLn (TextVariable, "This is some text.");
Close (TextVariable);
 
So far, we've described a fairly straightforward scheme: in, process, out. The reality is more complex. A program must be capable of performing different tasks under different circumstances – a feature that accounts for programming languages' power and versatility. And because a program hardly ever proceeds in a straight line from start to finish, there are commands that tell the computer to branch to different parts of the program to execute other commands. In BASIC, the command GOTO causes the execution to move to another part of the program. Assembly language does the same with the command JMP (short for jump).
Branching is used in combination with the Boolean logic functions of the programming languages. For example, when a program needs to change what it's doing because a particular condition exists, it can use "if •• then ••• " The program checks to see whether a certain condition is true, and if it is, the program then performs a certain command. For example, if the variable State is the string "Texas/' the program uses the abbreviation TX to address a letter.
 
Source: "How Computers Work" (9th edition) 


Артикли и предлоги Ratio analysis Подготовка к презентации на английском языке Digital word: practice using everyday words in a computer context Digital words: answers Functions of computers History of robotics Живое общение Personal finance The internet and the workplace