Java Reference
In-Depth Information
Summary
Section 4.1 Introduction
• Before writing a program to solve a problem, you must have a thorough understanding of the
problem and a carefully planned approach to solving it. You must also understand the building
blocks that are available and employ proven program-construction techniques.
Section 4.2 Algorithms
• Any computing problem can be solved by executing a series of actions (p. 102) in a specific order.
• A procedure for solving a problem in terms of the actions to execute and the order in which they
execute is called an algorithm (p. 102).
• Specifying the order in which statements execute in a program is called program control (p. 102).
Section 4.3 Pseudocode
• Pseudocode (p. 103) is an informal language that helps you develop algorithms without having
to worry about the strict details of Java language syntax.
• The pseudocode we use in this topic is similar to everyday English—it's convenient and user
friendly, but it's not an actual computer programming language. You may, of course, use your
own native language(s) to develop your own pseudocode.
• Pseudocode helps you “think out” a program before attempting to write it in a programming lan-
guage, such as Java.
• Carefully prepared pseudocode can easily be converted to a corresponding Java program.
Section 4.4 Control Structures
• Normally, statements in a program are executed one after the other in the order in which they're
written. This process is called sequential execution (p. 103).
• Various Java statements enable you to specify that the next statement to execute is not necessarily
the next one in sequence. This is called transfer of control (p. 103).
• Bohm and Jacopini demonstrated that all programs could be written in terms of only three control
structures (p. 103)—the sequence structure, the selection structure and the repetition structure.
• The term “control structures” comes from the field of computer science. The Java Language Spec-
ification refers to “control structures” as “control statements” (p. 104).
• The sequence structure is built into Java. Unless directed otherwise, the computer executes Java
statements one after the other in the order in which they're written—that is, in sequence.
• Anywhere a single action may be placed, several actions may be placed in sequence.
• Activity diagrams (p. 104) are part of the UML. An activity diagram models the workflow
(p. 104; also called the activity) of a portion of a software system.
• Activity diagrams are composed of symbols (p. 104)—such as action-state symbols, diamonds and
small circles—that are connected by transition arrows, which represent the flow of the activity.
• Action states (p. 104) contain action expressions that specify particular actions to perform.
• The arrows in an activity diagram represent transitions, which indicate the order in which the
actions represented by the action states occur.
• The solid circle located at the top of an activity diagram represents the activity's initial state
(p. 104)—the beginning of the workflow before the program performs the modeled actions.
• The solid circle surrounded by a hollow circle that appears at the bottom of the diagram repre-
sents the final state (p. 104)—the end of the workflow after the program performs its actions.
Search WWH ::




Custom Search