Java Reference
In-Depth Information
The type of coding used in Examples 1-1 to 1-3 is called pseudocode, which is
an ''outline'' of a program that could be translated into actual code. Pseudocode is not
written in a particular language, nor does it have syntax rules; it is mainly a technique to
show the programming steps.
1
Programming Methodologies
Two popular approaches to programming design are the structured approach and the
object-oriented approach, which are outlined below.
Structured Programming
Dividing a problem into smaller subproblems is called structured design. Each sub-
problem is then analyzed, and a solution for the subproblem is obtained. The solutions to
all the subproblems are then combined to solve the overall problem. This process of
implementing a structured design is called structured programming. The structured
design approach is also known as top-down design, bottom-up design, stepwise
refinement, and modular programming.
Object-Oriented Programming
Object-oriented design (OOD) is a widely used programming methodology. In
OOD, the first step in the problem-solving process is to identify the components called
objects, which form the basis of the solution, and to determine how these objects
interact with one another. For example, suppose you want to write a program that
automates the video rental process for a local video store. The two main objects in this
problem are the video and the customer.
After identifying the objects, the next step is to specify for each object the relevant data
and possible operations to be performed on that data. For example, for a video object, the
data might include:
￿ movie name
￿ starring actors
￿ producer
￿ production company
￿ number of copies in stock
Some of the operations on a video object might include:
￿
checking the name of the movie
￿
reducing the number of copies in stock by one after a copy is rented
￿
incrementing the number of copies in stock by one after a customer
returns a copy
 
 
 
Search WWH ::




Custom Search