Skip to content

Commit 0405885

Browse files
authored
Feature/service cutter documentation (ContextMapper#44)
1 parent a625cad commit 0405885

File tree

32 files changed

+511
-62
lines changed

32 files changed

+511
-62
lines changed
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
BoundedContext CargoTracking {
2+
Aggregate Cargo {
3+
owner CargoPlaner
4+
5+
Entity Cargo {
6+
aggregateRoot
7+
- TrackingId trackingId
8+
- Location origin
9+
- RouteSpecification routeSpecification
10+
- Itinerary itinerary
11+
- Delivery delivery
12+
}
13+
/* shortened Aggregate here */
14+
}
15+
Aggregate Location {
16+
owner Administrators
17+
18+
Entity Location {
19+
aggregateRoot
20+
- UnLocode unLocode
21+
String name
22+
}
23+
/* shortened Aggregate here */
24+
}
25+
Aggregate Handling {
26+
owner CargoTracker
27+
28+
DomainEvent HandlingEvent {
29+
- HandlingEventType handlingEventType
30+
- Voyage voyage
31+
- Location location
32+
Date completionTime
33+
Date registrationTime
34+
- Cargo cargo
35+
}
36+
/* shortened Aggregate here */
37+
}
38+
Aggregate Voyage {
39+
owner VoyageManager
40+
41+
Entity Voyage {
42+
aggregateRoot
43+
- VoyageNumber voyageNumber
44+
- Schedule schedule
45+
}
46+
/* shortened Aggregate here */
47+
}
48+
}
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<div class="highlight"><pre><span></span><span class="k">BoundedContext</span> CargoTracking {
2+
<span class="k">Aggregate</span> Cargo {
3+
<span class="k">owner</span> CargoPlaner
4+
5+
<span class="k">Entity</span> Cargo {
6+
<span class="k">aggregateRoot</span>
7+
- <span class="k">TrackingId</span> trackingId
8+
- <span class="k">Location</span> origin
9+
- <span class="k">RouteSpecification</span> routeSpecification
10+
- <span class="k">Itinerary</span> itinerary
11+
- <span class="k">Delivery</span> delivery
12+
}
13+
<span class="c">/* shortened Aggregate here */</span>
14+
}
15+
<span class="k">Aggregate</span> Location {
16+
<span class="k">owner</span> Administrators
17+
18+
<span class="k">Entity</span> Location {
19+
<span class="k">aggregateRoot</span>
20+
- <span class="k">UnLocode</span> unLocode
21+
<span class="k">String</span> name
22+
}
23+
<span class="c">/* shortened Aggregate here */</span>
24+
}
25+
<span class="k">Aggregate</span> Handling {
26+
<span class="k">owner</span> CargoTracker
27+
28+
<span class="k">DomainEvent</span> HandlingEvent {
29+
- <span class="k">HandlingEventType</span> handlingEventType
30+
- <span class="k">Voyage</span> voyage
31+
- <span class="k">Location</span> location
32+
<span class="k">Date</span> completionTime
33+
<span class="k">Date</span> registrationTime
34+
- <span class="k">Cargo</span> cargo
35+
}
36+
<span class="c">/* shortened Aggregate here */</span>
37+
}
38+
<span class="k">Aggregate</span> Voyage {
39+
<span class="k">owner</span> VoyageManager
40+
41+
<span class="k">Entity</span> Voyage {
42+
<span class="k">aggregateRoot</span>
43+
- <span class="k">VoyageNumber</span> voyageNumber
44+
- <span class="k">Schedule</span> schedule
45+
}
46+
<span class="c">/* shortened Aggregate here */</span>
47+
}
48+
}
49+
</pre></div>
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
UseCase ViewTracking {
2+
reads "Cargo.trackingId", "HandlingEvent.type", "HandlingEvent.location", "HandlingEvent.completionTime", "Delivery.transportStatus", "Delivery.estimatedArrivalTime", "Delivery.misdirected", "Voyage.voyageNumber", "RouteSpecification.destination"
3+
}
4+
5+
UseCase ViewCargos {
6+
reads "Cargo.trackingId", "RouteSpecification.destination", "RouteSpecification.arrivalDeadline", "Delivery.routingStatus", "Itinerary.itineraryNumber"
7+
}
8+
9+
UseCase BookCargo {
10+
reads "Location.unLocode"
11+
writes "Cargo.trackingId", "RouteSpecification.origin", "RouteSpecification.arrivalDeadline", "RouteSpecification.destination"
12+
}
13+
14+
UseCase ChangeCargoDestination {
15+
reads "Cargo.trackingId", "RouteSpecification.destination"
16+
writes "RouteSpecification.destination"
17+
}
18+
19+
/* we shortened this listing to save space (find all use cases in the original CML file) */
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<div class="highlight"><pre><span></span><span class="k">UseCase</span> ViewTracking {
2+
<span class="k">reads</span> <span class="s">&quot;Cargo.trackingId&quot;</span>, <span class="s">&quot;HandlingEvent.type&quot;</span>, <span class="s">&quot;HandlingEvent.location&quot;</span>, <span class="s">&quot;HandlingEvent.completionTime&quot;</span>, <span class="s">&quot;Delivery.transportStatus&quot;</span>, <span class="s">&quot;Delivery.estimatedArrivalTime&quot;</span>, <span class="s">&quot;Delivery.misdirected&quot;</span>, <span class="s">&quot;Voyage.voyageNumber&quot;</span>, <span class="s">&quot;RouteSpecification.destination&quot;</span>
3+
}
4+
5+
<span class="k">UseCase</span> ViewCargos {
6+
<span class="k">reads</span> <span class="s">&quot;Cargo.trackingId&quot;</span>, <span class="s">&quot;RouteSpecification.destination&quot;</span>, <span class="s">&quot;RouteSpecification.arrivalDeadline&quot;</span>, <span class="s">&quot;Delivery.routingStatus&quot;</span>, <span class="s">&quot;Itinerary.itineraryNumber&quot;</span>
7+
}
8+
9+
<span class="k">UseCase</span> BookCargo {
10+
<span class="k">reads</span> <span class="s">&quot;Location.unLocode&quot;</span>
11+
<span class="k">writes</span> <span class="s">&quot;Cargo.trackingId&quot;</span>, <span class="s">&quot;RouteSpecification.origin&quot;</span>, <span class="s">&quot;RouteSpecification.arrivalDeadline&quot;</span>, <span class="s">&quot;RouteSpecification.destination&quot;</span>
12+
}
13+
14+
<span class="k">UseCase</span> ChangeCargoDestination {
15+
<span class="k">reads</span> <span class="s">&quot;Cargo.trackingId&quot;</span>, <span class="s">&quot;RouteSpecification.destination&quot;</span>
16+
<span class="k">writes</span> <span class="s">&quot;RouteSpecification.destination&quot;</span>
17+
}
18+
19+
<span class="c">/* we shortened this listing to save space (find all use cases in the original CML file) */</span>
20+
</pre></div>
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BoundedContext CargoTracking {
2+
Aggregate Cargo {
3+
owner CargoPlaner
4+
5+
/* removed content here to save space */
6+
}
7+
Aggregate Location {
8+
owner Administrators
9+
10+
/* removed content here to save space */
11+
}
12+
Aggregate Handling {
13+
owner CargoTracker
14+
15+
/* removed content here to save space */
16+
}
17+
Aggregate Voyage {
18+
owner VoyageManager
19+
20+
/* removed content here to save space */
21+
}
22+
}
23+
24+
/* team definitions: */
25+
BoundedContext CargoPlaner { type TEAM }
26+
BoundedContext CargoTracker { type TEAM }
27+
BoundedContext VoyageManager { type TEAM }
28+
BoundedContext Administrators { type TEAM }
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<div class="highlight"><pre><span></span><span class="k">BoundedContext</span> CargoTracking {
2+
<span class="k">Aggregate</span> Cargo {
3+
<span class="k">owner</span> CargoPlaner
4+
5+
<span class="c">/* removed content here to save space */</span>
6+
}
7+
<span class="k">Aggregate</span> Location {
8+
<span class="k">owner</span> Administrators
9+
10+
<span class="c">/* removed content here to save space */</span>
11+
}
12+
<span class="k">Aggregate</span> Handling {
13+
<span class="k">owner</span> CargoTracker
14+
15+
<span class="c">/* removed content here to save space */</span>
16+
}
17+
<span class="k">Aggregate</span> Voyage {
18+
<span class="k">owner</span> VoyageManager
19+
20+
<span class="c">/* removed content here to save space */</span>
21+
}
22+
}
23+
24+
<span class="c">/* team definitions: */</span>
25+
<span class="k">BoundedContext</span> CargoPlaner { <span class="k">type</span> <span class="k">TEAM</span> }
26+
<span class="k">BoundedContext</span> CargoTracker { <span class="k">type</span> <span class="k">TEAM</span> }
27+
<span class="k">BoundedContext</span> VoyageManager { <span class="k">type</span> <span class="k">TEAM</span> }
28+
<span class="k">BoundedContext</span> Administrators { <span class="k">type</span> <span class="k">TEAM</span> }
29+
</pre></div>

Diff for: _data/docs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
- event-storming
7171
- event-sourcing-and-cqrs-modeling
7272
- jhipster-microservice-generation
73+
- systematic-service-decomposition
7374

7475
- title: IDE Plugins and Extensions
7576
docs:

Diff for: _docs/generators/service-cutter.md

+31-22
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,52 @@ For more information about Service Cutter we refer to its projects wiki and two
1212
* [Service Cutter: A Systematic Approach to Service Decomposition (Paper)](https://link.springer.com/chapter/10.1007/978-3-319-44482-6_12)
1313
* [Service Cutter: A Systematic Approach to Service Decomposition (HSR Bachelor Thesis)](https://eprints.hsr.ch/476/)
1414

15-
<div class="alert alert-custom">
16-
<strong>Note:</strong> The Service Cutter generators are not yet supported in our new Visual Studio Code extension. We continuously work on the extension and will support them soon! To use this generators you have to use the Eclipse plugin for now. You can find a feature support table for Eclipse and VS Code <a href="/docs/ide/">here</a>.
17-
</div>
18-
1915
## User Guide
2016
The following sections describe how to use the Service Cutter generators and create the input files for Service Cutter.
2117

2218
### Generate Entity Relationship Model File
2319
Service Cutter uses an [Entity-Relationship Model](https://github.com/ServiceCutter/ServiceCutter/wiki/ERM) Diagram (ERD) file that contains entities and nanoentities to describe the applications structure as its first and mandatory input.
2420

25-
We assume you have a CML file with your model in Eclipse (with our plugin installed). A right-click to the CML-file will guide you to a **Context Mapper** context menu. When selecting the action **Service Cutter: Generate Input File (JSON)**, you generate the Service Cutter ERD file in the required JSON format:
21+
We assume you have a CML file with your model in your IDE with Context Mapper installed. In the context menu of the editor you find the action **Generate Service Cutter Input (ERD as JSON)**. By running this command, you generate the Service Cutter ERD file in the required JSON format:
2622

2723
<a href="/img/service-cutter-input-generation-1.png">![Generate ServiceCutter ERD File](/img/service-cutter-input-generation-1.png)</a>
2824

29-
<div class="alert alert-custom">
30-
<strong>Note</strong> that the <strong>Context Mapper</strong> menu entry is also available within the context menu uf the CML editor
31-
(right-click anywhere in the editor).
32-
</div>
33-
3425
### Generate SCL File
3526
The second input file for Service Cutter deals with additional *User representations*. Service Cutter takes them in JSON format, but there is some manual work required to create these file. Hence, we implemented another DSL which makes this step much easier. These files have the file extension `*.scl*` (for *Service Cutter Language*).
3627

37-
A SCL file can be generated out of a CML file. Again, a right-click to the CML-file will open the **Context Mapper** context menu. You can initialize your SCL file with the action **Service Cutter: Initialize User Representations File (Exemplary)**:
28+
An SCL file can be generated out of a CML file. Again, a right-click in the CML editor will allow you to call the action **Generate Service Cutter User Representations (SCL)**:
3829

3930
<a href="/img/service-cutter-input-generation-2.png">![Generate ServiceCutter SCL File](/img/service-cutter-input-generation-2.png)</a>
4031

41-
**Note:** The generated SCL file is a template that intends to help you by setting the structure expected by Service Cutter. The following generated parts are only examples, and
42-
will have to be adjusted:
32+
The SCL grammar allows you to describe all [user representations supported by Service Cutter](https://github.com/ServiceCutter/ServiceCutter/wiki/User-Representations):
33+
34+
* Entity Relationship Model (ERM)
35+
* Use Cases
36+
* Shared Owner Groups
37+
* Aggregates
38+
* Entities
39+
* Predefined Services
40+
* Separated Security Zones
41+
* Security Access Groups
42+
* Compatibilities
43+
44+
Most of the user representations we derive from the CML model automatically. The ERM is derived from the Entities and their references in CML. The Use Cases and Shared Owner Groups can be modeled in CML as well (have a look at our [service decomposition tutorial](/docs/systematic-service-decomposition/)). We further derive the Aggregates and Entities for Service Cutter from the corresponding counterparts in CML. In addition, we derive Predefined Services from already existing Bounded Contexts of your CML model. The remaining user representations have to be described manually, in case they are relevant for your application.
45+
46+
However, the generated SCL file already contains most of the representations:
4347

44-
* **[Use Cases](https://github.com/ServiceCutter/ServiceCutter/wiki/Use-Cases)**
45-
* **All [Compatibilities](https://github.com/ServiceCutter/ServiceCutter/wiki/Compatibilities)**
46-
* **[Security Access Groups](https://github.com/ServiceCutter/ServiceCutter/wiki/Security-access-groups)**
47-
* **[Separated Security Zone](https://github.com/ServiceCutter/ServiceCutter/wiki/Separated-security-zones)**
48-
* **[Shared Owner Group](https://github.com/ServiceCutter/ServiceCutter/wiki/Shared-owner-groups)**
48+
<a href="/img/service-cutter-input-generation-2-1.png">![Generated SCL File](/img/service-cutter-input-generation-2-1.png)</a>
4949

50-
The following elements are actually derived from the CML model and do not have to be changed:
50+
**Note:** The automatically derived user representations are overwritten if you call the generator again.
5151

52-
* **[Aggregates](https://github.com/ServiceCutter/ServiceCutter/wiki/Aggregates)** (derived from your Aggregates in the CML file)
53-
* **[PredefinedService](https://github.com/ServiceCutter/ServiceCutter/wiki/Predefined-services)** (derived from your bounded contexts in the CML file)
52+
#### Examplary SCL File
53+
In case you want to add more user representations that are missing in the automatically generated ones, you can generate an exemplary SCL file that illustrates the syntax for all possible representations. Just call the **Generate Service Cutter User Representation Example File (SCL)** action to generate an example:
54+
55+
<a href="/img/service-cutter-input-generation-2-2.png">![Generate Exemplary SCL File](/img/service-cutter-input-generation-2-2.png)</a>
56+
57+
**Note:** This generated SCL file is only exemplary and intended to help you setting up the structure in the actual SCL file generated in the step above.
5458

5559
### Generate User Representations JSON File
56-
Once you have prepared your SCL file, you can generate the corresponding JSON file with the action **Service Cutter: Generate User Representations File (JSON)** in the context menu:
60+
Once you have prepared your SCL file, you can generate the corresponding JSON file with the action **Generate Service Cutter User Representation JSON File** in the context menu:
5761

5862
<a href="/img/service-cutter-input-generation-3.png">![Generate ServiceCutter JSON out of SCL File](/img/service-cutter-input-generation-3.png)</a>
5963

@@ -67,3 +71,8 @@ Have fun with cutting your services :)
6771
*Note:* Service Cutter has not been updated in a while, and only intended to demonstrate the possibilities of criteria-based graph clustering in the context of service decomposition (and establish a method and a first catalog of criteria). So do not expect mature, production-ready cuts to be suggested, but view them as a discussion and design workshop input. Further research is required to harden the approach; such research is ongoing (evidence: [40+ citations of the Service Cutter paper presented at ESOCC 2016](https://www.researchgate.net/publication/307873263_Service_Cutter_A_Systematic_Approach_to_Service_Decomposition)).
6872

6973
<a href="/img/service-cutter-insurance-example.png">![Service Cutter Insurance Example](/img/service-cutter-insurance-example.png)</a>
74+
75+
## Further Links
76+
Note that you can also generate new service cuts in Context Mapper directly without using Service Cutter! We integrated the Service Cutter library into Context Mapper so that our users are able to generate new service decompositions out of CML models easily.
77+
78+
* Have a look at our [Systematic Service Decomposition with Context Mapper and Service Cutter](/docs/systematic-service-decomposition/) tutorial.

0 commit comments

Comments
 (0)