File tree Expand file tree Collapse file tree 5 files changed +58
-0
lines changed Expand file tree Collapse file tree 5 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ # Domain
2+
Original file line number Diff line number Diff line change 1+ # Gateway
2+
3+ Contains IO adapters (e.g. files, database or API calls)
4+ These construct Domain objects for use by Use Cases, and, save Domain objects given to it
Original file line number Diff line number Diff line change 1+ # Made Tech Flavour Clean Architecture: Kotlin
2+
3+
4+ ## Testing
5+ * [ Spek] ( Spek.md ) (Spek specific test layout)
6+
7+ ## Production Code
8+
9+ Customer code should be housed within a Client package e.g. ``` com.acmeindustries.widget ```
10+
11+ Non-customer specfic code should be housed within a MadeTech namespace e.g. ``` com.madetech.authentication ```
12+
13+ * [ Use Cases] ( UseCases.md ) use_case/
14+ * [ Domain] ( Domain.md ) domain/
15+ * [ Gateway] ( Gateway.md ) gateway/
Original file line number Diff line number Diff line change 1+ # Spek
2+
3+ Coming soon!
Original file line number Diff line number Diff line change 1+ # Use Cases
2+
3+ ## Example
4+
5+ ``` kotlin
6+ package com.acmeindustries.widget.usecase
7+
8+ interface ViewWidgetPerFooBarReport {
9+ fun execute (request : Request ): Response
10+
11+ data class Request (public val fromDate : String , public val endDate : String )
12+ data class Response (...)
13+ }
14+ ```
15+
16+ ``` kotlin
17+ package com.acmeindustries.widget
18+
19+ import com.acmeindustries.widget.usecase.ViewWidgetPerFooBarReport
20+ import com.acmeindustries.widget.usecase.ViewWidgetPerFooBarReport.*
21+ import com.acmeindustries.widget.domain.Widget
22+
23+ class WidgetPerFooBarReport (val widgetGateway : WidgetGateway ) : ViewWidgetPerFooBarReport {
24+ fun execute (request : Request ): Response {
25+ val widgets = widgetGateway.all()
26+ // secret sauce here
27+ return Response (.. .) // return response populated with data
28+ }
29+ }
30+
31+ interface WidgetGateway {
32+ fun all (): List <Widget >
33+ }
34+ ```
You can’t perform that action at this time.
0 commit comments