Skip to content

Commit fb0c4c2

Browse files
respencer-nclclaude
andcommitted
Migrate RBBQ tutorial from riddl.tech
Migrates the Reactive BBQ case study tutorial from riddl/doc Hugo site: - Tutorial index with overview of available tutorials - Getting Started basics tutorial - Complete RBBQ case study including: - Domain model overview (reactive-bbq.md) - Scenario description with personnel interviews - Restaurant, BackOffice, Corporate subdomain documentation - 9 persona interview pages (CEO, Host, Server, Bartender, etc.) Content has been updated with: - Corrected relative links for MkDocs - Improved structure linking personas from main index - Enhanced subdomain pages with RIDDL examples Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3b794cc commit fb0c4c2

18 files changed

Lines changed: 893 additions & 0 deletions

File tree

docs/riddl/tutorials/basics.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
title: "Getting Started with RIDDL"
3+
description: "A basic introduction to RIDDL concepts and syntax"
4+
---
5+
6+
# Getting Started with RIDDL
7+
8+
This tutorial introduces the fundamental concepts of RIDDL through simple
9+
examples. After completing this tutorial, you'll understand:
10+
11+
- How to structure a RIDDL specification
12+
- The core building blocks: domains, contexts, entities
13+
- How to define types and messages
14+
- Basic handler patterns
15+
16+
## Your First RIDDL Specification
17+
18+
Every RIDDL specification starts with a domain. A domain represents a
19+
knowledge area or business capability:
20+
21+
```riddl
22+
domain Greeting is {
23+
context HelloWorld is {
24+
// Context contents go here
25+
}
26+
}
27+
```
28+
29+
## Adding Types
30+
31+
Types define the data structures in your domain:
32+
33+
```riddl
34+
domain Greeting is {
35+
context HelloWorld is {
36+
type Name is String
37+
type Greeting is {
38+
recipient: Name,
39+
message: String
40+
}
41+
}
42+
}
43+
```
44+
45+
## Defining an Entity
46+
47+
Entities are stateful objects that respond to commands and emit events:
48+
49+
```riddl
50+
domain Greeting is {
51+
context HelloWorld is {
52+
type Name is String
53+
54+
entity Greeter is {
55+
state GreeterState of Greeter.State
56+
57+
record State is {
58+
greetingsCount: Integer
59+
}
60+
61+
command SayHello is { to: Name }
62+
event HelloSaid is { to: Name, message: String }
63+
64+
handler GreeterHandler is {
65+
on command SayHello {
66+
send event HelloSaid(
67+
to = @SayHello.to,
68+
message = "Hello, " + @SayHello.to + "!"
69+
) to Greeter
70+
}
71+
}
72+
}
73+
}
74+
}
75+
```
76+
77+
## Key Concepts Illustrated
78+
79+
### Domains
80+
81+
Domains group related concepts and provide namespace isolation. A real
82+
system might have domains like `Sales`, `Inventory`, `CustomerService`.
83+
84+
### Contexts
85+
86+
Bounded contexts define clear boundaries within a domain. Each context has
87+
its own ubiquitous language - the same term can mean different things in
88+
different contexts.
89+
90+
### Entities
91+
92+
Entities are the core business objects. They:
93+
- Have identity (each instance is unique)
94+
- Have state (data that changes over time)
95+
- Have behavior (handlers that process commands)
96+
97+
### Types
98+
99+
RIDDL supports rich type definitions:
100+
- Simple types: `type UserId is UUID`
101+
- Records: `type Address is { street: String, city: String }`
102+
- Enumerations: `type Status is any of { Pending, Active, Closed }`
103+
- Alternations: `type Response is one of { Success, Failure }`
104+
105+
### Messages
106+
107+
Commands and events are the primary communication mechanism:
108+
- **Commands** - Requests to perform an action
109+
- **Events** - Facts that have occurred
110+
- **Queries** - Requests for information
111+
- **Results** - Responses to queries
112+
113+
## Next Steps
114+
115+
Now that you understand the basics, explore the
116+
[Reactive BBQ Case Study](rbbq/index.md) to see how these concepts apply
117+
to a real-world domain model.
118+
119+
For detailed syntax, see the [Language Reference](../references/language-reference.md).

docs/riddl/tutorials/index.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: "Tutorials"
3+
description: "A tutorial guide to RIDDL with the Reactive BBQ"
4+
---
5+
6+
Some people can learn RIDDL faster by looking at examples than they can by
7+
reading the informal definitions in the
8+
[language reference](../references/language-reference.md) or the
9+
formal definitions in the
10+
[EBNF grammar](../references/ebnf-grammar.md).
11+
To support that mode of learning, this tutorial decomposes the domain of a
12+
fictitious restaurant, The Reactive BBQ.
13+
14+
As you will see, the Reactive BBQ is an expansive domain. As such, this
15+
tutorial will not attempt to have you specify the entire domain. Rather, we
16+
will work through each feature of the RIDDL language by considering examples
17+
from inside the Reactive BBQ domain. We have fully specified it so that you
18+
have a concrete reference implementation and the companion language
19+
references to guide you.
20+
21+
## Available Tutorials
22+
23+
### [Getting Started](basics.md)
24+
25+
A basic introduction to RIDDL concepts and syntax.
26+
27+
### [Reactive BBQ Case Study](rbbq/index.md)
28+
29+
A comprehensive case study modeling a restaurant chain, demonstrating how to
30+
apply RIDDL to real-world domains. This tutorial includes:
31+
32+
- Domain decomposition into bounded contexts
33+
- Entity and repository modeling
34+
- Event-driven architecture patterns
35+
- User personas and use case analysis
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: "Back Office Subdomain"
3+
description: "Administrative operations in the Reactive BBQ domain model"
4+
---
5+
6+
# Back Office Subdomain
7+
8+
The Back Office subdomain handles administrative and management functions
9+
that support restaurant operations but aren't directly customer-facing.
10+
11+
## Bounded Contexts
12+
13+
### Scheduling
14+
15+
Manages staff schedules and shifts:
16+
17+
- **Shift Planning** - Creating weekly schedules
18+
- **Time Tracking** - Recording hours worked
19+
- **Coverage** - Ensuring adequate staffing
20+
21+
Key entities:
22+
- `Employee` - Staff member with role and availability
23+
- `Shift` - Time slot with required roles
24+
- `Schedule` - Weekly assignment of employees to shifts
25+
26+
### Inventory
27+
28+
Tracks stock levels and supplies:
29+
30+
- **Stock Levels** - Current inventory counts
31+
- **Reordering** - Automated low-stock alerts
32+
- **Receiving** - Recording deliveries
33+
34+
Key entities:
35+
- `InventoryItem` - Product with quantity and reorder point
36+
- `StockTransaction` - Record of stock changes
37+
- `PurchaseOrder` - Order to supplier
38+
39+
### Reporting
40+
41+
Generates management reports:
42+
43+
- **Sales Reports** - Daily, weekly, monthly summaries
44+
- **Labor Reports** - Hours and costs by department
45+
- **Inventory Reports** - Usage and waste tracking
46+
47+
## Integration Points
48+
49+
The Back Office subdomain integrates with:
50+
51+
- **Restaurant** - Receives sales data, provides schedules
52+
- **Corporate** - Sends reports, receives policies
53+
54+
```riddl
55+
context BackOffice is {
56+
adaptor RestaurantAdapter from context Restaurant is {
57+
// Transform Restaurant events into BackOffice commands
58+
on event SaleCompleted from Restaurant.FrontOfHouse {
59+
send command RecordSale to Reporting
60+
}
61+
}
62+
}
63+
```
64+
65+
## Challenges Addressed
66+
67+
| Challenge | Solution |
68+
|-----------|----------|
69+
| Report interference | Separate context, isolated resources |
70+
| Peak hour impacts | Async processing, eventual consistency |
71+
| Multi-timezone | Location-aware scheduling |
72+
73+
## Source Code
74+
75+
See the Back Office subdomain implementation:
76+
[backoffice/domain.riddl](https://github.com/ossuminc/riddl-examples/tree/main/src/riddl/ReactiveBBQ/backoffice)
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
title: "Corporate Subdomain"
3+
description: "Corporate headquarters operations in the Reactive BBQ domain model"
4+
---
5+
6+
# Corporate Subdomain
7+
8+
The Corporate subdomain handles operations that span all restaurant locations
9+
and are managed from the corporate headquarters.
10+
11+
## Bounded Contexts
12+
13+
### Menu Management
14+
15+
Centralized menu control as described by the [Head Chef](../personas/head-chef.md):
16+
17+
- **Recipe Development** - Creating and testing new dishes
18+
- **Menu Updates** - Monthly menu changes
19+
- **Pricing** - Setting prices across locations
20+
21+
Key entities:
22+
- `Recipe` - Ingredients, preparation, and presentation
23+
- `MenuItem` - Menu item with description and price
24+
- `MenuRelease` - Scheduled menu update
25+
26+
### Supply Chain
27+
28+
Manages ingredient sourcing and distribution:
29+
30+
- **Vendor Management** - Approved supplier relationships
31+
- **Bulk Ordering** - Centralized purchasing
32+
- **Distribution** - Shipping to restaurants
33+
34+
Key entities:
35+
- `Vendor` - Approved supplier with contracts
36+
- `BulkOrder` - Large-scale purchase order
37+
- `Shipment` - Delivery to restaurant locations
38+
39+
### Marketing
40+
41+
Coordinates brand and promotional activities:
42+
43+
- **Menu Photography** - Professional food images
44+
- **Promotions** - Special offers and campaigns
45+
- **Loyalty Program** - Customer rewards (planned feature)
46+
47+
## Integration Patterns
48+
49+
Corporate communicates with restaurants through message-based integration:
50+
51+
```riddl
52+
context MenuManagement is {
53+
entity Menu is {
54+
handler MenuHandler is {
55+
on command PublishMenu {
56+
// Broadcast to all restaurant locations
57+
send event MenuPublished to all Restaurant.Kitchen
58+
}
59+
}
60+
}
61+
}
62+
```
63+
64+
The menu update process uses a publish/subscribe pattern so that:
65+
- All locations receive updates simultaneously
66+
- Individual locations can't be in inconsistent states
67+
- Updates are atomic - either applied completely or not at all
68+
69+
## Challenges Addressed
70+
71+
From the [CEO interview](../personas/ceo.md):
72+
73+
| Challenge | Solution |
74+
|-----------|----------|
75+
| Menu coordination | Event-driven distribution |
76+
| Loyalty program risk | Isolated context, incremental rollout |
77+
| Electronic menu feasibility | Same menu data, different presentations |
78+
79+
## Source Code
80+
81+
See the Corporate subdomain implementation:
82+
[corporate/domain.riddl](https://github.com/ossuminc/riddl-examples/tree/main/src/riddl/ReactiveBBQ/corporate)

docs/riddl/tutorials/rbbq/index.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: "Reactive BBQ Case Study"
3+
description: "A comprehensive RIDDL tutorial using a restaurant chain domain"
4+
---
5+
6+
Some people can learn RIDDL faster by looking at examples than by reading
7+
the informal definitions in the
8+
[language reference](../../references/language-reference.md) or the
9+
formal definitions in the
10+
[EBNF grammar](../../references/ebnf-grammar.md). To support
11+
that mode of learning, this section decomposes the domain of a restaurant,
12+
Reactive BBQ.
13+
14+
## About Reactive BBQ
15+
16+
The Reactive BBQ domain is a familiar one for those who have taken the
17+
Lightbend Reactive Architecture Professional (LRA-P) course which uses
18+
this example throughout the course to good effect in the workshops. The same
19+
premises apply in this domain, but we have chosen to fully specify it in RIDDL.
20+
21+
As you might guess from the name, Reactive BBQ is a restaurant chain that
22+
serves spicy (reactive!) BBQ dishes. It doesn't exist of course, even if some
23+
people may or may not have mistaken
24+
[R&R BBQ in Salt Lake City](https://randrbbq.com/) for the _Reactive_
25+
version in 2018.
26+
27+
The Reactive BBQ case study in the LRA-P course included interviews with
28+
several fictitious employees. Those interviews and the case study material
29+
have been replicated in the [scenario description](scenario.md)
30+
with thanks to Lightbend; we recommend that you read that scenario first.
31+
32+
## Domain Structure
33+
34+
The RIDDL files for Reactive BBQ are arranged into a directory structure,
35+
each with an explanation page as follows:
36+
37+
- [Reactive BBQ Domain](reactive-bbq.md) - The top-level domain
38+
- [Restaurant](restaurant/index.md) - Restaurant operations context
39+
- [BackOffice](backoffice/index.md) - Back office administration context
40+
- [Corporate](corporate/index.md) - Corporate headquarters context
41+
42+
## Personas
43+
44+
The case study includes interviews with key personnel that inform the
45+
domain model:
46+
47+
- [CEO](personas/ceo.md) - Overall business challenges and vision
48+
- [Corporate Head Chef](personas/head-chef.md) - Menu and recipe management
49+
- [Host](personas/host.md) - Reservations and seating
50+
- [Server](personas/server.md) - Order taking and delivery
51+
- [Bartender](personas/bartender.md) - Drink orders and bar service
52+
- [Chef](personas/chef.md) - Kitchen operations
53+
- [Cook](personas/cook.md) - Food preparation
54+
- [Delivery Driver](personas/delivery-driver.md) - Delivery operations
55+
- [Online Customer](personas/online-customer.md) - Online ordering experience

0 commit comments

Comments
 (0)