Divide and Conquer

advertisement
Divide and
Conquer Methodology
Solve a Complex Problem
• Identify a number of simpler problems within the original
problem:
Modular Programming
• The modular programming methodology goes a step
further in specifying how the simpler problems should
be designed.
• Desirable properties:
Each simpler problem can be solved, programmed and
tested independently from each other.
Divide and Conquer
Break a complex problem into:
a number of simpler and independent problems
we can manage the complexity easier
Example
• Design Algorithm
• Design Classes
Information Hiding (1)
Information Hiding (2)
• Direct access:
The variables have public access and they are directly
accessible (= exposed) to the user.
• Indirect access:
The variables have private access and they indirectly
accessible (= hidden) to the user through public methods
Information Hiding (3)
Information Hiding (4)
• There are 2 aspects in the process of providing information
• Implementation = How is the data stored that are used to
provide the information.
• Functionality = What operations are allowed on the
information.
• Indirect access technique, makes the
functionality and implementation decoupled
Information Hiding (5)
Download