Skip to content

Commit

Permalink
Cookbook updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbrowndotje committed May 18, 2021
1 parent 51c816d commit e4acd9b
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 43 deletions.
1 change: 1 addition & 0 deletions docs/cookbook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Creating software architecture diagrams from a textual definition is becoming mo
- [System Context view](system-context-view)
- [Container view](container-view)
- [Component view](component-view)
- [Dynamic view](dynamic-view)
- [Deployment view](deployment-view)
- [Amazon Web Services](amazon-web-services)
- [Element styles](element-styles)
Expand Down
17 changes: 0 additions & 17 deletions docs/cookbook/dsl/example.dsl

This file was deleted.

26 changes: 0 additions & 26 deletions docs/cookbook/dsl/introduction.dsl

This file was deleted.

55 changes: 55 additions & 0 deletions docs/cookbook/dynamic-view/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Dynamic view

A [dynamic view](https://c4model.com/#DynamicDiagram) allows you to show a subset of the elements in a model, and the relationships between them, in order to describe how a particular use case/story/feature works. Dynamic views show ordered __instances__ of relationships, therefore reducing the number of relationships you need to define in the static model - see [Modelling multiple relationships](https://dev.to/simonbrown/modelling-multiple-relationships-51bf) for more.

```
workspace {
model {
customer = person "Customer"
onlineBookStore = softwareSystem "Online book store" {
webapp = container "Web Application"
database = container "Database"
}
customer -> webapp "Browses and makes purchases using"
webapp -> database "Reads from and writes to"
}
views {
container onlineBookStore {
include *
autoLayout lr
}
dynamic onlineBookStore {
title "Request past orders feature"
customer -> webapp "Requests past orders from"
webapp -> database "Queries for orders using"
autoLayout lr
}
dynamic onlineBookStore {
title "Browse top 20 books feature"
customer -> webapp "Requests the top 20 books from"
webapp -> database "Queries the top 20 books using"
autoLayout lr
}
}
}
```

This DSL defines three views:

1. A container view showing the user and containers - notice how the relationship between the user and the web application is quite general ("Browses and makes purchases using").
2. A dynamic view for the "request past orders" feature.
2. A dynamic view for the "browse top 20 books" feature.

[![](example-1.png)](http://structurizr.com/dsl?src=https://raw.githubusercontent.com/structurizr/dsl/master/docs/cookbook/dynamic-view/example-1.dsl)

Dynamic views can be rendered using the Structurizr cloud service/on-premises installation or exported to a number of other formats via the [Structurizr CLI export command](https://github.com/structurizr/cli/blob/master/docs/export.md).

## Links

- [DSL language reference - dynamic](https://github.com/structurizr/dsl/blob/master/docs/language-reference.md#dynamic-view)
35 changes: 35 additions & 0 deletions docs/cookbook/dynamic-view/example-1.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
workspace {

model {
customer = person "Customer"
onlineBookStore = softwareSystem "Online book store" {
webapp = container "Web Application"
database = container "Database"
}

customer -> webapp "Browses and makes purchases using"
webapp -> database "Reads from and writes to"
}

views {
container onlineBookStore {
include *
autoLayout lr
}

dynamic onlineBookStore {
title "Request past orders feature"
customer -> webapp "Requests past orders from"
webapp -> database "Queries for orders using"
autoLayout lr
}

dynamic onlineBookStore {
title "Browse top 20 books feature"
customer -> webapp "Requests the top 20 books from"
webapp -> database "Queries the top 20 books using"
autoLayout lr
}
}

}
Binary file added docs/cookbook/dynamic-view/example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e4acd9b

Please sign in to comment.