draw more, work less

59
Draw More, Work Less Computer Generated Diagrams IQSS Tech talk 2014-01-09 Michael Bar-Sinai

Upload: michael-bar-sinai

Post on 26-Aug-2014

1.167 views

Category:

Self Improvement


4 download

DESCRIPTION

Intro to some diagram auto-generation tools. For more info and sample files, head over to http://www.mbarsinai.com/blog/2014/01/12/draw-more-work-less/.

TRANSCRIPT

Page 1: Draw More, Work Less

Draw More, Work Less Computer Generated DiagramsIQSS Tech talk 2014-01-09 Michael Bar-Sinai

Page 2: Draw More, Work Less

Today:

Why and when computer-generated diagrams make sense?

GraphViz

PlantUML (and, also, UML)

Summary

Page 3: Draw More, Work Less

Why Let a Computer Draw

Work on semantic level

Play with parameters (layouts, skins)

Not that strange (HTML, LaTeX)

Play well with CVSs (git/svn/...)

Easy updates

Inspiration for DSLs/APIs

“From A to B”

A B

A B

A B

A

B

Page 4: Draw More, Work Less

GraphVizhttp://www.graphviz.org

“drawing graphs since 1988”

Open source, available to most platforms

Mainly Command-line, some GUIs exist

Page 8: Draw More, Work Less
Page 9: Draw More, Work Less

digraph towardsUnderstandingBurritos { burrito }

Page 10: Draw More, Work Less

digraph towardsUnderstandingBurritos { burrito }

dot -Tpdf burrito.gv > burrito.pdf

Page 11: Draw More, Work Less

digraph towardsUnderstandingBurritos { burrito }

dot -Tpdf burrito.gv > burrito.pdf

burrito

Page 12: Draw More, Work Less

digraph towardsUnderstandingBurritos { burrito tortilla beans corn wheat meat chicken rice tofu [label="Organic Tofu"] }

Page 13: Draw More, Work Less

digraph towardsUnderstandingBurritos { burrito tortilla beans corn wheat meat chicken rice tofu [label="Organic Tofu"] }

burrito tortilla beans corn wheat meat chicken rice Organic Tofu

Page 14: Draw More, Work Less

digraph towardsUnderstandingBurritos { burrito [color="blue" style="filled" fillcolor="#CCCCFF" shape=box] tortilla beans corn wheat meat chicken rice tofu [label="Organic Tofu"] }

burrito tortilla beans corn wheat meat chicken rice Organic Tofu

Page 15: Draw More, Work Less

digraph towardsUnderstandingBurritos { burrito[ color="blue" style="filled" fillcolor="#CCCCFF" shape=box ] tortilla beans corn wheat meat chicken rice tofu [label="Organic Tofu"] ! burrito -> tortilla [label="outside"] tortilla -> wheat tortilla -> corn ! burrito -> main [ label="inside" ] burrito -> side [ label="inside" ] side -> beans side -> rice main -> meat main -> chicken main -> tofu }

Page 16: Draw More, Work Less

digraph towardsUnderstandingBurritos { burrito[ color="blue" style="filled" fillcolor="#CCCCFF" shape=box ] tortilla beans corn wheat meat chicken rice tofu [label="Organic Tofu"] ! burrito -> tortilla [label="outside"] tortilla -> wheat tortilla -> corn ! burrito -> main [ label="inside" ] burrito -> side [ label="inside" ] side -> beans side -> rice main -> meat main -> chicken main -> tofu }

burrito

tortilla

outside

main

inside

side

inside

corn wheat beansmeat chicken riceOrganic Tofu

Page 17: Draw More, Work Less

digraph towardsUnderstandingBurritos { ... node [shape="egg" style="filled" fillcolor="#CCFFFF"] side main tortilla ! node [shape="septagon"] beans corn wheat meat chicken rice tofu [label="Organic\nTofu"] ... }

Page 18: Draw More, Work Less

digraph towardsUnderstandingBurritos { ... node [shape="egg" style="filled" fillcolor="#CCFFFF"] side main tortilla ! node [shape="septagon"] beans corn wheat meat chicken rice tofu [label="Organic\nTofu"] ... }

burrito

side

inside

main

inside

tortilla

outside

beans rice meat chicken OrganicTofu corn wheat

Page 19: Draw More, Work Less

digraph towardsUnderstandingBurritos { ... compound="true" ... subgraph cluster_filling { label="Filling" bgcolor="lightgray" side main node [shape="septagon"] beans meat chicken rice tofu [label="Organic\nTofu"] } node [shape="septagon"] corn wheat ! burrito -> tortilla [label="outside"] tortilla -> wheat tortilla -> corn ! burrito -> main [ lhead="cluster_filling" label="inside" ] ... }

Page 20: Draw More, Work Less

digraph towardsUnderstandingBurritos { ... compound="true" ... subgraph cluster_filling { label="Filling" bgcolor="lightgray" side main node [shape="septagon"] beans meat chicken rice tofu [label="Organic\nTofu"] } node [shape="septagon"] corn wheat ! burrito -> tortilla [label="outside"] tortilla -> wheat tortilla -> corn ! burrito -> main [ lhead="cluster_filling" label="inside" ] ... }

Filling

burrito

tortilla

outside

main

inside

corn wheat

side

beans ricemeat chicken OrganicTofu

Page 21: Draw More, Work Less

twopi -Tpdf burrito.gv > burrito.pdf

Page 22: Draw More, Work Less

twopi -Tpdf burrito.gv > burrito.pdf

burrito

sideinside

main inside

tortillaoutside

beans

rice

meat

chicken

OrganicTofu

corn

wheat

Page 23: Draw More, Work Less

Circo - Radial Layout

burrito sideinside

main

inside

tortilla

outsidebeans

rice

meat

chicken

OrganicTofu

corn

wheat

Page 24: Draw More, Work Less

neato - Spring model

burrito

sideinside

main

inside

tortilla

outside

beans

rice

meat

chickenOrganicTofu

corn

wheat

Page 25: Draw More, Work Less

fdp - Spring model, force direction

burrito

side

inside

main

insidetortilla

outside

beans

rice

meat

chicken

OrganicTofu

corn

wheat

Page 26: Draw More, Work Less

sfdp - Spring model, force direction

burrito

sideinside

maininside

tortilla

outside

beansricemeat

chicken

OrganicTofu

corn

wheat

Page 27: Draw More, Work Less

osage - Clustered, packed

Filling

burrito

tortilla

outside

main

inside

corn

wheat

side

beans

rice

meat

chickenOrganicTofu

Page 28: Draw More, Work Less

Power to the printf

���� �������

����

���

����

�������

�������

����������

����

�������

�������

���� �������

����

���

������� ���

����

���

���

���

������ ����

���

���

���

������

���

���

���

���

���

���

���

���

������

(generated from a ruby script simulating a logic circuit)

Page 29: Draw More, Work Less

Playing well with others

GraphViz native format

Easy to parse. Allows other programs to use it as a layout engine

SVG

Page 30: Draw More, Work Less

Playing well with others

GraphViz native format

Easy to parse. Allows other programs to use it as a layout engine

SVG

Combine with Javascript, HTML and JSON to get instant HTML5 website!

Page 31: Draw More, Work Less

Playing well with others

GraphViz native format

Easy to parse. Allows other programs to use it as a layout engine

SVG

Combine with Javascript, HTML and JSON to get instant HTML5 website!

Page 32: Draw More, Work Less

Much more

Bézier curves

Complex nodes (HTML tables)

Layout Constraints

Colors, gradients…

dot User’s Manual, December 22, 2009 17

past

1978

1980

1982

1983

1985

1986

1987

1988

1989

1990

future

Bourne sh

Cshell

ksh

make

build

nmake

SCCS

RCS

3D File System

yacc

ryacc

cron

yeast

Reiser cpp

ncpp

emacs

nmake 2.0

vi

<curses>

<curses-i>

fdelta

SBCS

C*

CSAS

Software IS

Adv. Software Technology

Configuration Mgt Architecture & Libraries Process

IMX

TTU

SYNED

Peggy

ksh-i

ksh-88

IFS

IFS-isfio

PG2

PEGASUS/PML

Ansi cpp

backtalk

CoShell

PAX

DAG

DIADOT

CIA

CIA++

ML-X

SHIP DataShareAPP

kyacc

Mosaic

libft

Figure 12: Drawing with constrained ranks

credit: dot User Manual, Gansner, Koutsofios, North

Page 33: Draw More, Work Less

PlantUMLAlso, UML

Page 34: Draw More, Work Less

Unified Modeling Language

Developed by OMG, a standard body

A diagram for every aspect of software

Structure, interactions, state, deployment…

Diagrams are also useful outside of the software world

Meta models and Formal Definitions

i

Date: September 2013

OMG Unified Modeling Language TM (OMG UML)

Version 2.5

OMG Document Number: ptc/2013-09-05

Normative Reference: http://www.omg.org/spec/UML/2.5

Machine Consumable Files:

http://www.omg.org/spec/UML/20131001/PrimitiveTypes.xmi

http://www.omg.org/spec/UML/20131001/UML.xmi

http://www.omg.org/spec/UML/20131001/StandardProfile.xmi

http://www.omg.org/spec/UML/20131001/UMLDI.xmi

Version 2.5 is formally a minor revision to the UML 2.4.1 specification, having been substantially re-written as solicited by the UML Specification Simplification RFP ad/09-12-10. It supersedes formal/2011-08-05 (Infrastructure) and formal/2011-08-06 (Superstructure).

Page 35: Draw More, Work Less

Unified Modeling Language

Developed by OMG, a standard body

A diagram for every aspect of software

Structure, interactions, state, deployment…

Diagrams are also useful outside of the software world

Meta models and Formal Definitions

i

Date: September 2013

OMG Unified Modeling Language TM (OMG UML)

Version 2.5

OMG Document Number: ptc/2013-09-05

Normative Reference: http://www.omg.org/spec/UML/2.5

Machine Consumable Files:

http://www.omg.org/spec/UML/20131001/PrimitiveTypes.xmi

http://www.omg.org/spec/UML/20131001/UML.xmi

http://www.omg.org/spec/UML/20131001/StandardProfile.xmi

http://www.omg.org/spec/UML/20131001/UMLDI.xmi

Version 2.5 is formally a minor revision to the UML 2.4.1 specification, having been substantially re-written as solicited by the UML Specification Simplification RFP ad/09-12-10. It supersedes formal/2011-08-05 (Infrastructure) and formal/2011-08-06 (Superstructure).

Page 36: Draw More, Work Less

PlantUML

Creates some UML diagrams from text files

Java component - embeddable

plugins include Netbeans, MS Word, Redmine, servlet…

http://plantuml.sourceforge.net/index.html

Page 37: Draw More, Work Less

@startuml !actor researcher participant website participant team as "Murray archive team" participant owner as "Data Owner" database archive !researcher -> website : Fill form researcher -> website : Submit form website -> team : new file! team -> owner : approve? !@enduml

Sequence Diagram

*process NOT accurate

Page 38: Draw More, Work Less

@startuml !actor researcher participant website participant team as "Murray archive team" participant owner as "Data Owner" database archive !researcher -> website : Fill form researcher -> website : Submit form website -> team : new file! team -> owner : approve? !@enduml

Sequence Diagram

plantuml sequence.uml

*process NOT accurate

Page 39: Draw More, Work Less

@startuml !actor researcher participant website participant team as "Murray archive team" participant owner as "Data Owner" database archive !researcher -> website : Fill form researcher -> website : Submit form website -> team : new file! team -> owner : approve? !@enduml

Sequence Diagram

plantuml sequence.uml

*process NOT accurate

Page 40: Draw More, Work Less

@startuml !actor researcher participant website participant team as "Murray archive team" participant owner as "Data Owner" database archive !researcher -> website : Fill form researcher -> website : Submit form website -> team : new file! team -> owner : approve? !alt owner agrees owner -> team : OK team -> researcher : more forms researcher -> team : filled more forms team -> researcher : grant access researcher -> archive : read !else owner declines owner -> team : No team -> researcher : Sorry... end !@enduml

*process NOT accurate

Page 41: Draw More, Work Less

@startuml !actor researcher participant website participant team as "Murray archive team" participant owner as "Data Owner" database archive !researcher -> website : Fill form researcher -> website : Submit form website -> team : new file! team -> owner : approve? !alt owner agrees owner -> team : OK team -> researcher : more forms researcher -> team : filled more forms team -> researcher : grant access researcher -> archive : read !else owner declines owner -> team : No team -> researcher : Sorry... end !@enduml

*process NOT accurate

Page 42: Draw More, Work Less

@startuml actor researcher participant website participant team as "Murray archive team" participant owner as "Data Owner" database archive !researcher -> website : Fill form researcher -> website : Submit form website -> team : new file! team -> owner : approve? ...Time goes by... alt owner agrees owner -[#green]> team : OK team -> researcher : more forms researcher -> team : filled more forms team -> researcher : grant access researcher -> archive : read !else owner declines owner -[#FF0000]> team : No team -> researcher : Sorry... note right: Researcher may try again. end @enduml

*process NOT accurate

Page 43: Draw More, Work Less

Activity Diagram

@startuml start :Get to Room; :Hang Coat; stop @enduml

Updated flowcharts

Page 44: Draw More, Work Less

Activity Diagram

@startuml start !:Get to room; :Hang Coat; :Try to pour coffee; if (Got coffee?) then (yes) :fill cup; else (no) :comlain loudly; :prepare; :wait; :fill cup; endif :go to desk; :start working; !stop @enduml

Page 45: Draw More, Work Less

Activity Diagram@startuml start :Get to room; :#FFDDDD:Hang Coat; :Try to pour coffee; if (Got coffee?) then (yes) :#AAFFAA:fill cup; else (no) :#red:comlain loudly; :prepare; note right make sure to only press the "brew" button <b>once</b>! end note :wait; :fill cup; endif :go to desk; :start working; stop @enduml

Page 46: Draw More, Work Less

Activity Diagram - Parallel Work

@startuml start :Recognize need for burrito; :Get Cookin'; fork :mix ingredients; :bake; fork again :grind; :fry; fork again :chop; :cook; :drain; end fork :roll up; :eat; stop @enduml

Page 47: Draw More, Work Less

Activity Diagram

@startuml :Recognize need for burrito; repeat :Get Cookin'; fork :mix ingredients; :bake; fork again :grind; :fry; fork again :chop; :cook; :drain; end fork :roll up; :eat; repeat while (still hungry?) @enduml

Page 48: Draw More, Work Less

Use Case

@startuml actor user actor admin !usecase ingest as "Ingest data into the system --- various formats supported " usecase manage as "Manage system === Also make sure the grants are mentioned properly" usecase analyze as "Analyze Data" (Use Zelig) @enduml

Analyze user types, usages for the system, and how they all relate to each other (useful!)

Page 49: Draw More, Work Less

Use Case

@startuml actor user actor admin !usecase ingest as "Ingest data into the system --- various formats supported " usecase manage as "Manage system === Also make sure the grants are mentioned properly" usecase analyze as "Analyze Data" (Use Zelig) @enduml

Analyze user types, usages for the system, and how they all relate to each other (useful!)

Page 50: Draw More, Work Less

Use Case

@startuml actor user actor admin !usecase ingest as "Ingest data into the system --- various formats supported “...” usecase analyze as "Analyze Data” (Use Zelig) !user <|-- admin analyze <|--(Use Zelig) !user --> analyze user --> ingest admin --> manage !@enduml

Page 51: Draw More, Work Less

Use Case

@startuml left to right direction actor user actor admin rectangle System { usecase ingest as "Ingest data into the system --- various formats supported " usecase manage as "Manage system === Also make sure the grants are mentioned properly" usecase analyze as "Analyze Data" (Use Zelig) } ... @enduml

Page 52: Draw More, Work Less

Salt - ASCII art GUI modeling

@startsalt { Hello... [X] World [] Kitty [] There [Submit] } @endsalt

Page 53: Draw More, Work Less

Salt - ASCII art GUI modeling

@startsalt { Hello... [X] World [] Kitty [] There [Submit] } @endsalt

____________________________ < ASCII art is Moo-gnificent > ---------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||

Page 54: Draw More, Work Less

Salt - ASCII art GUI modeling

@startsalt { Hello... [X] World [] Kitty [] There [Submit] } @endsalt

____________________________ < ASCII art is Moo-gnificent > ---------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||

Page 55: Draw More, Work Less

Salt - ASCII art GUI modeling

@startsalt { Hello... [X] World [] Kitty [] There [Submit] } @endsalt

____________________________ < ASCII art is Moo-gnificent > ---------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||

Page 56: Draw More, Work Less

Salt - ASCII art GUI modeling

@startsalt { Hello... [X] World |(X) World [] Kitty |() Kitty [] There |() There [Submit All] | [Submit one] } @endsalt

Page 57: Draw More, Work Less

Salt - ASCII art GUI modeling

@startsalt {+ Hello... {/<b>Select Many | Select one | like us on LinkedBook } { [X] World [] Kitty [] There [] other | ^Select....^ } === { [Submit] | [Cancel] | [Tweet us on FaceIn] } }@endsalt

Page 58: Draw More, Work Less

…Summing Up

Sometimes its better to concentrate on the structure, and let the computer do the layout

There are free, capable tools for diagraming

Both GraphViz and PlantUML have numerous features not covered in this talk

Page 59: Draw More, Work Less

Thanks.

Draw More, Work Less Computer Generated Diagrams