140 likes | 153 Views
This paper discusses the criteria for decomposing systems into modules to improve flexibility, comprehensibility, and development time. It provides a historical perspective and highlights the benefits of using a modular approach in software design. Examples and techniques for information hiding are also presented.
E N D
On the Criteria to Be Used in Decomposing Systems into Modules D. L. Parnas
Modularization • Modularization is a mechanism for improving the flexibility and comprehensibility of a system while shortening its development time • The system must be decomposed into modules (a.k.a subsystems) using certain criteria • A lot of what this paper talks about is common day knowledge, but remember that it was written in the early 1970’s
Historical Perspective • The concept of a module was not new when this paper was written • BUT, although others spoke about what a module was, nothing was done to describe how a system is decomposed into modules • Major contribution is that Parnas provides criteria for decomposing systems into modules (and not for the notion of a module itself)
Benefits of using a Modular Approach to Software Design • Managerial – individual modules can be developed concurrently since they will be specified by their external behavior and interfaces • Flexibility – individual modules should be able to be changed without radical impact to the rest of the system • Program Understanding – possible to study the systems more abstractly – by understanding the modules prior to understanding the code
What is a Module • A module is not a subprogram it’s a work assignment • Design at the module level first – then define the modules themselves • A module is categorized by the design decision(s) that it hides from all of the other modules in the system (information hiding) • Sounds a lot like the approaches we use today for design of object- and component-oriented programs (30+ years later)
Dividing a System into Modules • A module is physically categorized by a well defined interface that is small and simple enough to be thoroughly understood and well programmed • There is no question about what a modules is - the real question is about how a system is decomposed into modules, and how to compare one modularization to another modularization
Parnas Example: KWIC Index – Classical Modularization Input Storage (File/Memory) CircularShift Controller Alphabetizing Output Criteria for Decomposition: Processing Steps
Parnas Example: KWIC Index – Information Hiding Modularization Input Storage (File/Memory) Line Storage Controller CircularShifter Alphabetizer Output Criteria for Decomposition: Information Hiding
Revisiting the Motivation for using a Modular approach to Design Software • Changeability – The information hiding approach supports change much easier. The classical technique would require modifications to many modules to support most changes – the IH approach hides representation behind module interfaces • Independent Development – IH interfaces are more abstract, supporting concurrent development easier (consider needing to change the data structure) • Comprehensibility – As per the changeability benefits described above – more detailed understanding of the overall system is required with the classical technique The IH approach better supports exception management and error processing
Example: J2EE Generation 1: Servlets • Simple approach towards web-based system development • Servlet does not hide very much information • Manages the entire UI, all of the control logic, all of the business logic, and any database interaction http Servlet http
Example: J2EE Generation 2: Servlets & JSP’s • Better separation of input and output processing • Support for different output formats • Servlet still “knows” too much about overall system • Its hard to reuse certain aspects of a system using a servlet/jsp solution http Servlet JSP http
Example: J2EE Generation 3: Full MVC Approach • Good example ofinformation hiding • Well defined interfaces • Reuse presentation andbusiness logic • Reuse componentsoutside of the webdomain http Controller (Servlet) Configuration View Beans Action Classes Result Beans Exceptions Business Logic http JSP
Summary • Parnas mentions some constraints about information hiding such as needing to go through interfaces and the cost associated with doing so • Parnas suggests some techniques to deal with these problems • Fortunately, today we don’t have to worry about the overhead of function and/or method calls • Doesn’t the information hiding approach sound a lot like OO?
Summary • Parnas also gives another plug for upfront design by stating that the criteria used to decompose a system into modules cannot be easily determined at runtime • Parnas suggests that to check the degree of information hiding compliance you should investigate change scenarios • Parnas demonstrated this on the IH decomposition of the KWIC system by showing some IH gaps and a design flaw • Parnas further comments on hierarchies by stating that the decomposition of a system into modules does not necessarily need to be hierarchical