From e71c53047a035a04521acbf68a5bf50b5ad08396 Mon Sep 17 00:00:00 2001 From: Luca Tassinari Date: Fri, 12 Jan 2024 23:30:48 +0100 Subject: [PATCH] docs: init page on blog posts --- docs/content/_index.md | 1 + docs/content/docs/blog-posts-service.md | 37 +++++++++++++++++++++++++ docs/content/menu/index.md | 6 ++++ docs/hugo.toml | 1 + 4 files changed, 45 insertions(+) create mode 100644 docs/content/docs/blog-posts-service.md create mode 100644 docs/content/menu/index.md diff --git a/docs/content/_index.md b/docs/content/_index.md index 4b27f958..eef10054 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -14,5 +14,6 @@ Analyze aspects such as: ## Roadmap 1. [Boundary and break](./docs/boundaries) +2. [Blog posts service example: a direct-style vs monadic comparison](./docs/blog-posts-service) TBD diff --git a/docs/content/docs/blog-posts-service.md b/docs/content/docs/blog-posts-service.md new file mode 100644 index 00000000..9bebe959 --- /dev/null +++ b/docs/content/docs/blog-posts-service.md @@ -0,0 +1,37 @@ +# Blog posts service example: a direct-style vs monadic comparison + +## The need for a new `Future` construct + +The current implementation of the `Future` monadic construct suffers the following main cons: + +- Lack of **referential transparency** +- Lack of **cancellation** mechanisms (and _structured concurrency_) +- **Accidental Sequentiality** + +## Example: a blog posts service + +> **Idea**: develop a very simple (mocked) service which allows to store and retrive from a repository blog posts, as well as perform some checks before the actual storage. + +The example has been implemented using: + +- the current Scala `Future` constructs; +- the mechanism abstractions offered by `gears`; +- Kotlin. + +The sources are available in the `posts` package of both Kotlin and Scala main folders. + +### Structure + +#### Scala + +Uses Cake Pattern: + +- `PostsRepositoryComponent` + - is the component exposing the `Repository` trait allowing to store and retrieve blog posts; + - mocking a DB technology with an in-memory collection +- `PostsServiceComponent` + - is the component exposing the `Service` interface. + +Both the components must be designed in an async way. + +### 1st version: current Future monadic diff --git a/docs/content/menu/index.md b/docs/content/menu/index.md new file mode 100644 index 00000000..a94c9c62 --- /dev/null +++ b/docs/content/menu/index.md @@ -0,0 +1,6 @@ +--- +headless: true +--- + +- [Boundary & Break]({{< relref "/docs/boundaries" >}}) +- [Blog posts service example]({{< relref "/docs/blog-posts-service" >}}) \ No newline at end of file diff --git a/docs/hugo.toml b/docs/hugo.toml index 5c97bb9f..07eed7f0 100644 --- a/docs/hugo.toml +++ b/docs/hugo.toml @@ -16,3 +16,4 @@ enableGitInfo = true # to enable 'Last Modified by' date and git author informat BookTheme = 'auto' BookRepo = 'https://github.com/tassiLuca/PPS-22-direct-style-experiments' # used for 'Last Modified' and 'Edit this page' links BookCommitPath = 'commit' + BookMenuBundle = '/menu' \ No newline at end of file