4.3 Modules


4.3 Modules

A problem is often too complex to deal with as a single unit. A general approach is to divide the problem into smaller problems that are easier to solve. The partitioning of a problem into smaller parts is known as decomposition. These small parts are called modules, which are easier to manage.

Program design usually emphasizes modular structuring, also called modular decomposition. A problem is divided into smaller problems (or subproblems), and a solution is designed for each subproblem. Therefore, the solution to a problem consists of several smaller solutions corresponding to each of the subproblems. This approach is called modular design. Object-oriented design enhances modular design by providing classes as the most important decomposition (modular) unit. As an example, Figure 4.2 shows a program that consists of four modules.

click to expand
Figure 4.2: General structure of program.




Object-Oriented Programming(c) From Problem Solving to Java
Object-Oriented Programming (From Problem Solving to JAVA) (Charles River Media Programming)
ISBN: 1584502878
EAN: 2147483647
Year: 2005
Pages: 184

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net