Decomposition Into Modules: Jan Bredereke: SCS4: Engineering of Embedded Software Systems, WS 2002/03
Decomposition Into Modules: Jan Bredereke: SCS4: Engineering of Embedded Software Systems, WS 2002/03
Overview of Chapter 3
163
Overview of Chapter 3:
Decomposition Into Modules
3.1 the criteria to be used in decomposing systems into
modules
3.2 structuring complex software with the module guide
3.3 time and space decomposition of complex structures
3.4 designing software for ease of extension and contraction
165
166
What is a Module?
167
What is a Module?
historically: a unit of measure
e.g., 2,54 cm
168
169
170
171
172
173
174
175
Write-Time Modules
176
Write-Time Modules
we want the following properties:
can be designed and changed independently
can be sub-divided into further modules
177
178
output
COLOUR OF MAGIC THE
EQUAL RITES
FANTASTIC THE LIGHT
LIGHT FANTASTIC THE
MAGIC THE COLOUR OF
MORT
MOVING PICTURES
OF MAGIC THE COLOUR
PICTURES MOVING
RITES EQUAL
THE COLOUR OF MAGIC
THE LIGHT FANTASTIC
179
THE COLOUR
MOVING
EQUAL
COLOUR OF MAGIC
EQUAL RITES
FANTASTIC
LIGHT FANTASTIC
MAGIC
MORT
MOVING PICTURES
OF MAGIC
PICTURES
RITES
THE COLOUR OF MAGIC
THE LIGHT FANTASTIC
180
(discussion)
editor
181
Conventional Modularization
Conventional Modularization
1. Input Module
182
Conventional Modularization
183
Conventional Modularization
3. Alphabetizing Module
takes the arrays of modules 1 and 2
produces an array in format of module 2
the result is ordered alphabetically
input interface: memory format
output interface: memory format
184
Conventional Modularization
4. Output Module
takes the arrays of module 3 and 1
produces formatted output listing
maybe: mark start of line, . . .
input interface: memory format
output interface: paper format, conventions, . . .
185
Conventional Modularization
186
187
2. memory formats
(a) keep all lines in memory?
(b) pack characters four to a word?
(c) store shifts explicitly / as index+offset
5. different alphabetizations
(a) ignore case
(b) locale
6. output format
(a) different visual output layouts
(b) truncate overlong lines in output
(c) generate output for different formatting tools
188
Parnas Modularization
189
Parnas Modularization
1. Line Holder Module
special purpose memory to hold lines of KWIC index
interface programs:
GET CHAR(lineno, wordno, charno)
SET CHAR(lineno, wordno, charno, char)
CHARS(lineno, wordno)
WORDS(lineno)
LINES
DELETE LINE(lineno)
DELETE WORD(lineno, wordno)
Jan Bredereke: SCS4: Engineering of Embedded Software Systems, WS 2002/03
Parnas Modularization
2. Input Module
reads from input medium
calls line-holder programs to store in memory
interface program:
INPUT
190
Parnas Modularization
191
Parnas Modularization
4. Alphabetizer Module
does actual sorting of the shifts
may or may not produce a new list
if it doesnt, it makes a directory
interface programs:
ALPH
ITH(lineno)
. . . (some more supporting programs)
192
Parnas Modularization
5. Output Module
does the actual printing
calls ITH and circular shift programs
interface program:
OUTPUT
193
Parnas Modularization
194
different:
way of cutting up the system
interfaces
195
196
changeability:
2nd modularization better changeable (compare list on slide 187)
independent development:
1st: cooperation of all teams until best data representation is found
2nd: teams can start independently early
comprehensibility:
1st: output module can be understood only by understanding some
constraints of the alphabetizer, shifter, and input module
The Criteria
197
The Criteria
criteria for designing information-hiding modules:
identify the design decisions that are likely to change
requires experience and judgement
is additional work up-front
198
input module
input format
alphabetizer module
sorting algorithm
time when alphabetization is done
output module
output format
Jan Bredereke: SCS4: Engineering of Embedded Software Systems, WS 2002/03
199
200
201
Module Structure
202
Module Structure
system structure:
a systems parts and their connections
connections: the modules interfaces (i.e., assumptions)
parts: work assignments (modules)
203
inline functions/methods
templates
204
205
206