11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

202 FORTRANearly days <strong>of</strong> microcomputing because the lack <strong>of</strong> need fora sophisticated interpreter or compiler meant that Forthsystems could run comfortably on systems that had perhaps16K or 64K <strong>of</strong> available RAM.Forth never caught on with the mainstream <strong>of</strong> programmers,however. Its very uniqueness <strong>and</strong> the unusual mindsetit required probably limited the number <strong>of</strong> people willing tolearn it. While Forth programs can be clearly organized,badly written Forth programs can be virtually impossibleto read. However, Forth is sometimes found “under thehood” in surprising places (for example, the PostScript pagedescription language is similar to Forth) <strong>and</strong> the languagestill has a considerable following in designing hardwarecontrol devices (see embedded systems).Further ReadingBrodie, L. Starting FORTH. 2nd ed. Upper Saddle River, N.J.: PrenticeHall, 1987.———. Thinking FORTH. 2nd ed. Upper Saddle River, N.J.: PrenticeHall, 1994.Forth Interest Group. Available online. URL: http://www.forth.org. Accessed August 14, 2007.Rather, Elizabeth D. Forth Application Techniques. Hawthorne,Calif.: FORTH, Inc., 2006.FORTRANAs computing became established throughout the 1950s,the need for a language that could express operations in amore “human-readable” language began to be acutely felt.In a high-level language, programmers define variables <strong>and</strong>write statements <strong>and</strong> expressions to manipulate them. Theprogrammer is no longer concerned with specifying thedetailed storage <strong>and</strong> retrieval <strong>of</strong> binary data in the computer,<strong>and</strong> is freed to think about program structure <strong>and</strong> theproper implementation <strong>of</strong> algorithms.Fortran (FORmula TRANslator) was the first widelyused high-level programming language. It was developedby a project begun in 1954 by a team under the leadership<strong>of</strong> IBM researcher John Backus. The goal <strong>of</strong> the project wasto create a language that would allow mathematicians, scientists,<strong>and</strong> engineers to express calculations in somethingclose to the traditional notation. At the same time, a compilerwould have to be carefully designed so that it wouldproduce executable machine code that would be nearly asefficient as the code that would have been created throughthe more tedious process <strong>of</strong> using assembly languages. (Seecompiler <strong>and</strong> assembler.)The first version <strong>of</strong> the language, Fortran I, becameavailable as a compiler for IBM mainframes in 1957. Animproved (<strong>and</strong> further debugged version) soon followed.Fortran IV (1963) exp<strong>and</strong>ed the number <strong>of</strong> supporteddata types, added “common” data storage, <strong>and</strong> includedthe DATA statement, which made it easier to load literalnumeric values into variables. This mature version <strong>of</strong> Fortranwas widely embraced by scientists <strong>and</strong> engineers, whocreated immense libraries <strong>of</strong> code for dealing with calculationscommonly needed for their work.By the 1970s, the structured programming movementwas well under way. This school <strong>of</strong> programming emphasizeddividing programs into self-contained procedures intowhich data would be passed, processed, <strong>and</strong> returned. Theuse <strong>of</strong> unconditional branches (GOTO statements) as wascommon in Fortran was now discouraged. A new version <strong>of</strong>the language, Fortran 77 (or F77), incorporated many <strong>of</strong> thenew structural features. The next version, Fortran 90 (F90),added support for recursion, an important technique forcoding certain kinds <strong>of</strong> problems (see recursion). Mathematicslibraries were also modernized. FORTRAN 2003contains a number <strong>of</strong> new features, including support formodern programming structures (see object-orientedprogramming) <strong>and</strong> the ability to interface smoothly withprograms written in the C language. A relatively minor furtherrevision has the tentative name FORTRAN 2008.Sample ProgramThe following simple example illustrates some features <strong>of</strong> atraditional FORTRAN program:INTEGER INTARRAY(10)INTEGER ITEMS, COUNTER, SUM, AVGSUM = 0READ *, ITEMSDO 10 COUNTER = 1, ITEMSREAD *, INTARRAY(COUNTER)SUM = SUM + INTARRAY(COUNTER)10 CONTINUEAVG = SUM / ITEMSPRINT ‘SUM OF ITEMS IS: ’, SUMPRINT ‘AVERAGE IS: ’, AVGSTOPENDThe program creates an array holding up to ten integers(see array). The first number it reads is the number <strong>of</strong> itemsto be added up. It stores this in the variable ITEMS. A DOloop statement then repeats the following two statementsonce for each number from 1 to the total number <strong>of</strong> items.Each time the two statements are executed, COUNTER isincreased by 1. The statements read the next number fromthe array <strong>and</strong> add it to the running total in SUM. Finally, theaverage is calculated <strong>and</strong> the sum <strong>and</strong> average are printed.Like its contemporary, COBOL, Fortran is viewed bymany modern programmers as a rather clumsy <strong>and</strong> anachronisticlanguage (because <strong>of</strong> its use <strong>of</strong> line number references,for example). However, there is a tremendous legacy<strong>of</strong> tested, reliable Fortran code <strong>and</strong> powerful math libraries.(For example, a Fortran program can call library routinesto quickly get the sum or cross-product <strong>of</strong> any array ormatrix.) These features ensure that Fortran has continuingappeal <strong>and</strong> utility to users who are more concerned withgetting fast <strong>and</strong> accurate results than with the niceties <strong>of</strong>programming style.Further ReadingChapman, Stephen J. Fortran 95/2003 for Scientists & Engineers.3rd ed. New York: McGraw-Hill, 2007.Chivers, Ian, <strong>and</strong> Jane Sleightholme. Introduction to Programmingwith Fortran: With Coverage <strong>of</strong> Fortran 90, 95, 2003 <strong>and</strong> 77.New York: Springer, 2005.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!