The traditional approach to programming uses a procedural paradigm (sometimes called “imperative paradigm”) to conceptualize the solution to a problem as a sequence of steps. A program written in a procedural language typically consists of self-contained instructions in a sequence that indicates how a task is to be performed or a problem is to be solved.
A programming language that supports the procedural paradigm is called a procedural language. Procedural languages are well suited for problems that can be easily solved with a linear, or step–by-step, algorithm. Programs created with procedural languages have a starting point and an ending point.
The flow of execution from the beginning to the end of the program is essentially linear – that is, the computer begins at the first instruction and carries out the prescribed series of instructions until it reaches the end of the program.
An algorithm is a set of steps for carrying out a task that can be written down and implemented. An algorithm for a computer program is a set of steps that explains how to begin with known information specified in a problem statement and how to manipulate that information to arrive a solution. In a later phase of the software development process, the algorithm is coded into instructions written in a programming language so that a computer can implement it.
To design an algorithm, you might begin by recording the steps you take to solve the problem manually. The computer also needs the initial information, so the part of your algorithm must specify how the computer gets it. Next, your algorithm should also specify how to manipulate this information and, finally, how the computer decides what to display as the solution.
You can express an algorithm in several different ways, including structured English, pseudocode, and flowcharts. These tools are not programming languages, and they cannot be processed by a computer. Their purpose is to give you a way to document your ideas for program design.
Structured English is a subset of the English language with a limited selection of sentence structures that reflects processing activities. Another way to express an algorithm is with pseudocode. Pseudocode is a notational system for algorithms that has been described as a mixture of English and your favorite programming language.
A third way to express an algorithm is to use a flowchart. A flowchart is a graphical representation of the way a computer should progress from one instruction to the next when it performs a task.
Before finalizing the algorithm for a computer program, you should perform a walkthrough to verify that your algorithm works. To perform a walkthrough for a simple program, you can use a calculator, paper, and pencil to step through a sample problem using realistic “test” data.
For more complex programs, a walkthrough might consist of a verbal presentation to a group of programmers who can help identify logical errors in the algorithm and suggest ways to make the algorithm more efficient.
The algorithm specifies the order in which program instructions are performed by the computer. Unless you do otherwise, sequential execution is the normal pattern of program execution. During sequential execution, the computer performs each instruction in the order it appears – the first instruction in the program is executed first, then the second instruction, and so on, to the last instruction in the program.
Some algorithms specify that a program must execute instructions in an order different from the sequence in which they are listed, skip some instructions under certain circumstances, or repeat instructions. Control structures are instructions that specify the sequence in which program is executed. Most programming languages have three types of control structures: sequence controls, selection controls, and repetition controls.
A sequence control structure changes the order in which instructions are carried out by directing the computer to execute an instruction elsewhere in the program.
A sequence control structure directs the computer to the statements they contain, but when these statements have been executed, the computer neatly returns to the main program.
A selection control structure, also referred to as a “decision structure” or “branch”, tells a computer what to do, based on whether a condition is true or false. A simple example of a selection control structure is the IF…THEN…ELSE command.
A repetition control structure directs the computer to repeat one or more instructions until certain condition is met. The section of code that repeats is usually referred to as a loop or “iteration”. Some of the most frequently used repetition commands are FOR…NEXT, DO…WHILE, DO…UNTIL, and WHILE…WEND (which means “while ends”).
All the first programming languages were procedural. The first widely used standardized computer language, FORTRAN, with its procedural paradigm set the pattern for other popular procedural languages, such as COBOL, APL, ALGOL, PL/1, PASCAL, C, ADA, and BASIC.
The procedural approach is best suited for problems that can be solved by following a step-by-step algorithm. It has been widely used for transaction processing, which is characterized by the use of a single algorithm applied to many different sets of data. For example, in banking industry, the algorithm for calculating checking account balances is the same, regardless of the amounts deposited and withdrawn. Many problems in math and science also lend themselves to the procedural approach.
The procedural approach and procedural languages tend to produce programs that run quickly and use system resources efficiently. It is a classic approach understood by many programmers, software engineers, and system analysts. The procedural paradigm is quite flexible and powerful, which allows programmers to apply it to many types of problems.
The downside of the procedural paradigm is that it does not fit gracefully with certain types of problems – those that are unstructured or those with very complex algorithms. The procedural paradigm has also been criticized because it forces programmers to view problems as a series of steps, whereas some problems might better be visualized as interacting objects or as interrelated words, concepts, and ideas.
Task 8. Indicate the paragraph where the following ideas are found in the text.
1. A program written in a procedural language contains the prescribed series of instructions.
2. An algorithm shows the steps how to manipulate the information to arrive at a solution.
3. There are different tools to express an algorithm.
4. To make sure that your algorithm works, you should verify it.
5. Program instructions can be executed in order they are listed or some instructions can be skipped or repeated.
6. Many problems in banking industry lend themselves to the procedural approach.
Task 9. Match up the words that are opposite in meaning.
sequential parallel algorithm
downside problem
to focus written
solution advantage
to deposit to distract
linear algorithm random
verbal to withdraw
Task 10. Fill in the blanks choosing from the variants given.
1. During … execution,the computer performs each instruction in the order it appears – the first instruction in the program is executed first, then the second instruction, and so on, to the last instruction in the program.
a) random b) sequential c) direct d) reverse
2. The main... of procedural paradigm is that it forces programmers to view problems as a series of steps, whereas some problems might better be visualized as interacting objects or as interrelated words, concepts, and ideas.
a) benefit b) advantage c) drawback d) downside
3. The fact that algorithms are usually written in a format that is not specific to a particular programming language allows you … on formulating a correct algorithm.
a) to concentrate b) to focus c) to distract
4. The traditional approach to programming uses a procedural paradigm to conceptualize the … a problem as a sequence of steps.
a) problem b) decision c) solution
5. The algorithm for calculating checking account balances is the same, regardless of the amounts … and.....
a) invested, placed, deposited b) drawn out, withdrawn, taken away
6. Procedural languages are well suited for problems that can be easily solved with … algorithm.
a) chain b) linear c) parallel
7. For complex programs, a walkthrough might consist of a... presentation to a group of programmers who can help identify logical errors in the algorithm and suggest ways to make the algorithm more efficient.
a) written b) graphical c) verbal
Task 11. Make three-word combinations using the words in columns and then fill in the gaps in the following sentences.
A: selection B: account C: instruction
self step-by-step algorithm
software computer balances
standardized development language
checking control process
linear contained structure
1. The procedural approach is best suited for problems that can be solved by following a ….
2. A …, also referred to as a “decision structure” or “branch”, tells a computer what to do, based on whether a condition is true or false.
3. The first widely used …, FORTRAN, with its procedural paradigm set the pattern for other popular procedural languages.
4. In banking industry, the algorithm for calculating … is the same.
5. A program written in a procedural language typically consists of... in a sequence that indicates how a task is to be performed or a problem is to be solved.
6. The algorithm is coded into instructions written in a programming language which a computer can implement in a later phase of the ….
Task 12. Discuss the following questions.
1. What is proceduralprogramming?
2. What is an algorithm?
3. How do you write an algorithm?
4. What is the best way to express an algorithm?
5. How do you know if your algorithm is correct?
6. In what order does a computer perform program instructions?
7. Can the computer make decisions while it executes a program?
8. What are the most popular procedural languages?
9. What kinds of problems are best suited to the procedural approach?
10. What are the advantages and disadvantages of the procedural paradigm?
Task 14. Translate the following sentences into English.
1. Якщо вам вдалося написати програму, в якій транслятором не виявлено помилок, зверніться до системного програмісту - він виправить помилки в трансляторі.
2. У природі програмування лежить те, що немає співвідношення між "розмірами" самої помилки і проблем, які вона спричиняє.
3. Якщо налагодження - процес видалення помилок, то програмування має бути процесом їх внесення.
4. Машинна програма виконує те, що ви наказали їй робити, а не те, що б ви хотіли, щоб вона робила.
5. Складність програми зростає до тих пір, поки не перевищить здатності програміста.
6. Якби архітектори будували будівлі так, як програмісти пишуть програми, то перший залетівший жук зруйнував би цивілізацію.
7. Ніколи не виявляйте в програмі помилки, якщо ви не знаєте, що з ними робити далі.
WORD FORMATION
COMPOUND WORDS
There are three forms of compound words:
· the closed form, in which the words are melded together, such as firefly, secondhand, softball, childlike, crosstown, redhead, keyboard, makeup, notebook;
· the hyphenated form, such as daughter-in-law, master-at-arms, over-the-counter, six-pack, six-year-old, mass-produced;
· and the open form, such as post office, real estate, middle class, full moon, half sister, attorney general.
Exercise 1. With a handful of exceptions, compounds created by the addition of a prefix are not hyphenated. Read and translate the following words.
antisocial, binomial, biochemistry, coordinate, counterclockwise, extraordinary, infrastructure, interrelated, intramural, macroeconomics, metaphysical, microeconomics, midtown, minibike, multicultural, neoromantic, nonviolent, overanxious, postwar, preconference, pseudointellectual, reunify, semiconductor, socioeconomic, subpar, supertanker, transatlantic, unnatural, underdeveloped
Exceptions include
compounds in which the second element is capitalized or a number:
anti-Semitic, pre-1998, post-Freudian
compounds which need hyphens to avoid confusion
un-ionized (as distinguished from unionized), co-op
compounds in which a vowel would be repeated (especially to avoid confusion)
co-op, semi-independent, anti-intellectual (but reestablish, reedit)
compounds consisting of more than one word
non-English-speaking, pre-Civil War
compounds that would be difficult to read without a hyphen
pro-life, pro-choice, co-edited
Exercise 2. Read and translate the words. Mind the spelling of these words.
2-year education
one-week vacation
African American
Air Force
all-city tournament
attorney general
blood pressure
blue-green dress
bull's-eye
database
daughter-in-law
English-speaking person
ex-wife
first-rate accommodations
football
grandmother
grant-in-aid
great-aunt half sister
high-level officials
Italian-American
Italian-American club
jack-in-the-box
lifelike
light year
mayor-elect
salesperson
secretary-treasurer
stockbroker
T-square
threefold
up-to-the-minute
V-formation
vice president
well-made clothes
worldwide inflation
X-ray
With a series of nearly identical compounds, we sometimes delay the final term of the final term until the last instance, allowing the hyphen to act as a kind of place holder, as in
· The third- and fourth-grade teachers met with the parents.
· Both full- and part-time employees will get raises this year.
· We don't see many 3-, 4-, and 5-year-old children around here.
Exercise 3. Study the most popular compound computer terms. Translate them into Ukrainian.