swt - diagrammatics lecture 2/4 - diagramming in computer science 27-april-2000
TRANSCRIPT
![Page 1: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/1.jpg)
SWT - Diagrammatics
Lecture 2/4 - Diagramming in Computer Science27-April-2000
![Page 2: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/2.jpg)
Review
• Definitions,• Historical Facts,
– Maps, Geometry, Topological Diagrams, Science and Diagrams.
• Advantages of Diagramming,• Diagram use across fields.
![Page 3: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/3.jpg)
Overview
• Diagram Distinctions • Diagram Taxonomies• Diagram use in Computer Science
– Venn, Flowcharts, NSD’s, Structure, Dataflow, ERD’s, Cell and Arrows, State, Petri nets.
• Logic Gate Diagrams• How to operate Theseus under CM
![Page 4: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/4.jpg)
Diagram Distinctions• Diagrams portray associations:
– metric, – topological and – symbolic
• In computer systems, above the hardware level, Euclidean space is unimportant
• Much more common in software diagrams are associations in topological space.
![Page 5: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/5.jpg)
Diagram Distinctions• Within topological diagrams, associations can happen in
three principal ways:– Adjoinment
– Linkage
– Containment
A B
A B
A B
![Page 6: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/6.jpg)
Diagram Taxonomies• A Taxonomy is useful only to the ones that use it.• A simple diagrammatic taxonomy can be based on the
diagrammatic domain.• Several researchers have focused on a variety of
diagrammatic aspects and have proposed respective classifications.
• Efforts to categorise diagrams have created a large set of taxonomies.
• Alan. Blackwel * has proposed a taxonomy of taxonomies :* http://www.mrc-cbu.cam.ac.uk/projects/twd/mypapers/TwD98.html
![Page 7: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/7.jpg)
A taxonomy of Diagram Taxonomies• Dimensions of categorisation :
– 1. The representation :• the graphic domain & structure
– 2. The message :• the information domain
– 3. The relation between the representation and the message :• Pictorial correspondence
– 4. The process of interpreting and modifying representations :• Information processing & tools
– 5. The context - convention :• Cultural conventions
– 6. The mental representation• Interpersonal variation
![Page 8: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/8.jpg)
Venn Diagrams• Are related to circuits and logic gates• Elements use containment to depict information• Standard mathematical functions like “a set of”,
“a genuine subset of” etc are depicted• Easy to compare Venn Diagrams because of
their visual representation
![Page 9: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/9.jpg)
Venn Diagrams• The two following Venn diagrams show that the next two
functions are equal:– NOT(A OR B)– (NOT(A)) AND (NOT(B))
• You can write a small java program to verify this if you want!
NOT(A OR B) (NOT(A)) AND (NOT(B))
NOT A
NOT B
non shaded part is equal to double-shaded part
A
B
![Page 10: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/10.jpg)
Flowcharts• They are topological, graph-based constructions that are
often filled with program text.• The control logic of the program is shown through simple
branches and loops.• They are usually generated by analysts as a specification
to programmers, who then convert the charts into source code.
• However, for large systems, they can get messy, spanning in many pages as decisions have many branches.
• Goldstine claims he created the first flowchart for computers in 1947, while working with Von Neumann.
![Page 11: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/11.jpg)
Flowchartsstart
format disk
formatanother?
get formatting parameters
end
yes
noI/O
Terminal
DisplayIf
Process
![Page 12: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/12.jpg)
Nassi-Shneiderman (NS) Diagrams• Hierarchy is shown using
enclosure and adjacency• Decisions are shown by splitting the
lines into smaller, parallel boxes• Loops are shown by enclosing a small
box into a box labelled with the condition of the loop
• However, the early termination of loops (e.g. break) and multiple conditionals present problems for NS diagrams
![Page 13: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/13.jpg)
Nassi-Shneiderman (NS) Diagramss1
if i1true false
if i2
while w1
while w2
true falses2
s3s4 s5
s6
s7
s8
![Page 14: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/14.jpg)
Structure Diagrams• They are hierarchical, modular
break downs of a program• Between tree levels, links indicate what
kind of information travels between levels
• They are usually represented by trees• They are a part of the “structural analysis” activity, in
which a system is partitioned in a top-down manner• However, a multitude of labelled edges and nodes
conveying lots of information can reduce readability
![Page 15: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/15.jpg)
Structure Diagramscalculate payroll
get employeeand pay record
calculate net pay
printpay cheque
calculate deductions
calculate tax
records
record name
employee name
salarypayment
employee name
payment
date & time
overtime
tax deductions
employee category expenses
![Page 16: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/16.jpg)
Data-flow Diagrams
• Are oriented to flow-type operations• Objects of data are shown in relationship to procedures• No decision logic is shown• The diagrams are most often used to model the flow of
data• However, they usually get large and complex and
multiple-page spanning happens nearly always
![Page 17: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/17.jpg)
Dataflow DiagramsSALES DEPT
ORDER FILE
CUSTOMER FILE
GETCUSTOMER
RECORD
CHECKCUSTOMER
CREDIT ORDER INFORMATION
CREATE NEWCUSTOMER
RECORD
CUSTOMER RECORD
NEW CUSTOMER INFORMATION
CUSTOMER FILE
NEW CUSTOMER RECORD
COLLECT ALL ORDERS FOR
CUSTOMER
INVALID CUSTOMER
CUSTOMERINFORMATION
CUSTOMER ORDER RECORDS
![Page 18: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/18.jpg)
Entity-Relationship (ER) Diagrams
• The representation of data is often accomplished using diagrams
• ER diagrams are usually used to depict databases• Extremely simple – three types of nodes• Entity and Relations form a graph and can have
associated attributes and cardinality
Attribute Entity Relationship
![Page 19: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/19.jpg)
Entity-Relationship (ER) Diagrams
DepartmentEmployee Manager
CompanyPerson
Manages
IsA IsA
Works-forName
SSN Salary
Job title
NameAddress
Phone nr
Name
HasMany
![Page 20: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/20.jpg)
Software Level Charts• At a higher level, the functions of a system are often
thought as layers• These diagrams work only on simple access schemes• However, more complex
schemes will result in a complex graph that cannot be represented with adjoining regions
Application
Unix Operating System
Unix API
X-lib DB API
Motif
![Page 21: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/21.jpg)
Cell and Arrow Diagrams• In a combination of adjoinment and link-based
conventions, data structures are often depicted as adjacent memory locations linked by pointers
• This is usually used for teaching purposes or for program documentation
• In programming, pointer manipulation of linked lists is shown as diagrams of Cell and Arrows
![Page 22: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/22.jpg)
Cell and Arrow Diagrams
start
element1
element2
elementN …
start
Insertion of a new element (element2) into a linked list
temp
NULL
element1 elementN
NULL
(1)
(2)
(3)
![Page 23: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/23.jpg)
State Transition Diagrams• Well known in computer science as originating from the
study of finite automata• Are used for modelling a variety of event-based CS
domains including parsing, user interface design, and circuit design
• At the application level, they represent transaction flows, appliance controls, marketing scripts etc
• With the exception of special symbols and terminal nodes, all nodes are treated the same.
![Page 24: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/24.jpg)
State Transition DiagramsRecognise if the pattern “bc” exists in string “aabaaabbabca”
s1 s2 s3b
ac
a
b
c
![Page 25: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/25.jpg)
Petri Nets• Are closely related to data flow graphs• The main distinction is that the graphs are bipartite,
made up of a set of places and transitions• Useful for concurrent, asynchronous, distributed,
parallel, and nondeterministic systems.• Each type of node can be further subdivided into
subtypesannihilator
generator
trivial transition
splitting
collection
terminal place
initial place
trivial place
branching
junction
![Page 26: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/26.jpg)
Petri NetsD available
Request D Request D
D Ready
FinishedWith D and P
D Ready
FinishedWith D and P
P available
ProcessProcess ReleaseD and P
ReleaseD and P
P ReadyP Ready
Request PRequest P
![Page 27: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/27.jpg)
Logic Gates• Logic gates are the components of logic circuits• There are three main gates: AND, OR and NOT• An AND gate returns “true” (or 1) if both of its inputs are
“true”• An OR gate returns “true” (or 1) if either of its inputs is
“true”• A NOT gate returns the opposite of its input
AND OR NOT
A B Q0 0 00 1 01 0 01 1 1
A B Q0 0 00 1 11 0 11 1 1
A Q0 11 0
![Page 28: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/28.jpg)
Logic Circuits• Logic circuits are used in electronic devices.• Formed by combining many logic gates• More complex logic circuits are assembled from
simpler ones which in turn are assembled from gates
A B Q0 0 00 1 11 0 11 1 0
![Page 29: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/29.jpg)
Combining gates Together• A N input gate can be constructed by placing N
gates in a special configuration :
xyz
xyz
o
o
xyz o
xyz
o
![Page 30: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/30.jpg)
Other Logic Gates
• Include: nand
nor
xnor
xor
buffer
A B Q
0 0 1
0 1 0
1 0 0
1 1 0
A B Q
0 0 1
0 1 1
1 0 1
1 1 0
A B Q
0 0 0
0 1 1
1 0 1
1 1 0
A B Q
0 0 1
0 1 0
1 0 0
1 1 1
![Page 31: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/31.jpg)
Analog Circuit Diagrams
• Represent electronic design schemata• Strict Notation - Graph-Network topology• No direction
![Page 32: SWT - Diagrammatics Lecture 2/4 - Diagramming in Computer Science 27-April-2000](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649cba5503460f949821a8/html5/thumbnails/32.jpg)
The end of lecture 2