1
Chair of Softw are Engineering
Software Architecture Bertrand Meyer 2005
Last update: 22 June 2005
Designing for reuse
Chair of Softw are Engineering
Lecture 13
3 Chair of Softw are Engineering
1 Typical API in a traditional library (NAG) nonlinear_ode ( - - PDF document
Software Architecture Bertrand Meyer 2005 Designing for reuse Last update: 22 June 2005 Chair of Softw are Engineering Lecture 13 Chair of Softw are Engineering Designing for reuse Formula-1 programming The opportunity to get things
Chair of Softw are Engineering
Last update: 22 June 2005
Chair of Softw are Engineering
3 Chair of Softw are Engineering
4 Chair of Softw are Engineering
4 in out values; 3 arrays, used both as input and output; 6 functions, each with 6 or 7 arguments, of which 2 or 3 arrays!]
5 Chair of Softw are Engineering
6 Chair of Softw are Engineering
7 Chair of Softw are Engineering
8 Chair of Softw are Engineering
CONTAINER
*
BOX
*
COLLECTION
*
TRAVERSABLE
*
FINITE
*
INFINITE
* *
UNBOUNDED
*
COUNTABLE
*
RESIZABLE
*
BAG
*
SET
*
HIERARCHICAL
*
LINEAR
*
TABLE
*
ACTIVE
*
INTEGER_ INTERVAL
*
BILINEAR
*
INDEXABLE
*
CURSOR_ STRUCTURE
*
DISPENSER
*
SEQUENCE
*
STRING HASH_TABLE STACK
*
QUEUE
*
… …
BOUNDED ARRAY
9 Chair of Softw are Engineering
Number
features Perfect Desirable
?
Number of (re)uses
10 Chair of Softw are Engineering
11 Chair of Softw are Engineering
12 Chair of Softw are Engineering
13 Chair of Softw are Engineering
14 Chair of Softw are Engineering
l.insert (x, j + k + 1) i <= count + 1 insert (x: G; i: INTEGER) require i >= 0
15 Chair of Softw are Engineering
before item after count not before not after Valid cursor positions
16 Chair of Softw are Engineering
after must be true for the iteration. For symmetry: before should be true too.
17 Chair of Softw are Engineering
18 Chair of Softw are Engineering
not after before not before after item count count + 1 1 not after; not before 1 <= index; index <= count Valid cursor positions
19 Chair of Softw are Engineering
not after before not before after 1 (i.e. count + 1) Valid cursor positions
20 Chair of Softw are Engineering
21 Chair of Softw are Engineering
22 Chair of Softw are Engineering
Internal size: includes non-exported features. External size: includes exported features only.
Immediate size: includes new (immediate) features only. Flat size: includes immediate and inherited features. Incremental size: includes immediate and redeclared features.
23 Chair of Softw are Engineering
Feature of a class Immediate Redeclared Redefined Effected Inherited Kept
New in class From parent Changed Unchanged Was deferred Had an implementation
24 Chair of Softw are Engineering
Feature of a class Immediate Redeclared Redefined Effected Inherited Kept
New in class From parent Changed Unchanged Was deferred Had an implementation
25 Chair of Softw are Engineering
26 Chair of Softw are Engineering
27 Chair of Softw are Engineering
28 Chair of Softw are Engineering
29 Chair of Softw are Engineering
30 Chair of Softw are Engineering
31 Chair of Softw are Engineering
32 Chair of Softw are Engineering
Window color Hidden?
White No
set_background_color set_visible set_hidden
background_color hidden
33 Chair of Softw are Engineering
34 Chair of Softw are Engineering
enter push add insert
remove_oldest delete
entry top
value
35 Chair of Softw are Engineering
36 Chair of Softw are Engineering
if s.deletable then s.delete (v) end
if s.addable then s.add (v) end
37 Chair of Softw are Engineering
38 Chair of Softw are Engineering
class C inherit
…
feature -- Category 1 … Feature declarations feature { A, B} -- Category 2 … Feature declarations feature { NONE} -- Category n … Feature declarations invariant
…
end
39 Chair of Softw are Engineering
40 Chair of Softw are Engineering
41 Chair of Softw are Engineering
42 Chair of Softw are Engineering
Chair of Softw are Engineering