Chapter 13 模块化与信息隐藏.pptVIP

  • 24
  • 0
  • 约1.26万字
  • 约 69页
  • 2021-01-07 发布于安徽
  • 举报
Information Hiding Each module hides the implementation of an important design decision so that only the constituents of that module know the details Especially if there is a list of all possible design changes is made - Hiding Assumption List All design decisions are independent of each other Criteria for decomposition Modularization 1 Each major step in the processing was a module Modularization 2 Information hiding Each module has one or more secrets” Lines how characters/lines are stored Circular Shifter algorithm for shifting, storage for shifts Alphabetizer algorithm for alpha, laziness of alpha Each module is characterized by its knowledge of design decisions which it hides from all others. General Comparison General Note: both systems might share the same data structures and the same algorithms Differences are in the way they are divided into work assignments Systems are substantially different even if identical in the runnable representation Possible because the runnable representation is used only for running Other representations are used for Changing Documenting Understanding – … Changeability Comparison Design decisions that may change Input format: (1, 1) All lines stored in memory: (all, 1) Pack characters 4 to a word: (all, 1) Make an index for circular shifts rather than store them: (3,1) Alphabetize once, rather than either: (3,1) Search for each item as needed Partially alphabetize, partially search Independent Development Modularization 1 Must design all data structures before parallel work can proceed Complex descriptions needed Modularization 2 Must design interfaces before parallel work can begin Simple descriptions only Comprehensibility Modularization 2 is better Parnas subjective judgment Less coupling among modules Programming to interfaces Modularization with Information Hiding A Responsibility Assignment rather than sub-program. Represented by a design decision specific to itself and unknown to other modules Support flexibility in i

文档评论(0)

1亿VIP精品文档

相关文档