Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
yohamta committed May 25, 2024
1 parent a08a93a commit 9f5bb94
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
build/
.DS_Store
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Dew: A Lightweight, Pragmatic Command Bus Library for Go
# Dew: A Command Oriented Interface + Middleware System for Go

[![Go Reference](https://pkg.go.dev/badge/github.com/go-dew/dew.svg)](https://pkg.go.dev/github.com/go-dew/dew)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-dew/dew)](https://goreportcard.com/report/github.com/go-dew/dew)
[![codecov](https://codecov.io/gh/go-dew/dew/branch/main/graph/badge.svg?token=3ZQZQZQZQZ)](https://codecov.io/gh/go-dew/dew)

<img src="assets/dew.png" alt="dew logo" style="width: 200px;" />

Dew is a command bus library for Go, designed to enhance developer experience and productivity. It utilizes the [command-oriented interface](https://martinfowler.com/bliki/CommandOrientedInterface.html) pattern, which allows for separation of concerns, modularization, and better readability of the codebase, eliminating unnecessary cognitive load.
Dew is a command oriented interface library + Middleware System for Go. With the unified interface, we can be free from the cognitive load for maintaining different interfaces for each operation handler or domain logic.

<img src="assets/overview.webp" alt="dew overview" />

## Features

Expand Down Expand Up @@ -83,11 +85,11 @@ Dew uses the following terminology:
- **Middleware**: Functions that execute logic (e.g., logging, authorization, transaction management) before and after command execution.
- **Bus**: Manages registration of handlers and routing of actions and queries to their respective handlers.

## What is Command Bus?
## What is the Command Oriented Interface Pattern?

A command bus is a design pattern that separates the execution of commands from their processing logic. It decouples the sender of a command from the handler, enhancing code modularization and separation of concerns.
It utilizes the [command-oriented interface](https://martinfowler.com/bliki/CommandOrientedInterface.html) pattern, which allows for separation of concerns, modularization, and better readability of the codebase, eliminating unnecessary cognitive load.

You can find more about the command bus pattern in the following articles:
You can find more about the pattern in the following articles:

- [Command Oriented Interface by Martin Fowler](https://martinfowler.com/bliki/CommandOrientedInterface.html)
- [What is a command bus and why should you use it?](https://barryvanveen.nl/articles/49-what-is-a-command-bus-and-why-should-you-use-it)
Expand All @@ -97,13 +99,6 @@ You can find more about the command bus pattern in the following articles:

I've been working on multiple complex backend applications built in Go over the years, and looking for a way to make the code more readable, maintainable, and more fun to work with. I believe Command Bus architecture could be an answer to this problem. However, I couldn't find a library that fits my needs, so I decided to create Dew.

There are several benefits to using Dew:

- It provides a bus interface that utilizes Go's generics to handle commands and queries, allowing for better performance and ease of use.
- The middleware system allows for adding features like logging, authorization, and transaction management for groups of handlers with granular control. See [middleware example](#middleware) and [authorization example](examples/authorization/main.go) for more details.
- The unified bus interface eliminates the need for creating and managing a clutter of mock objects of different interfaces, making the unit tests more readable and fun to work with. See [testing example](#testing-example-mocking-command-handlers) for more details.
- With its built-in support for asynchronous queries, Dew can handle multiple queries concurrently, reducing the time to retrieve data from multiple sources. See [QueryAsync example](#executing-queries) for more details.

Dew is designed to be lightweight with zero dependencies, making it easy to integrate into any Go project.

## A Convention for Actions and Queries
Expand Down
Binary file added assets/overview.webp
Binary file not shown.
Binary file added docs/source/_static/overview.webp
Binary file not shown.
6 changes: 5 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ Welcome to Dew's documentation!
:alt: Dew logo
:width: 400px

A Lightweight, Pragmatic Command Bus library for Go.
A Command Oriented Interface + Middleware System for Go.

.. image:: _static/overview.webp
:alt: Dew overview
:width: 800px

Features
--------
Expand Down
4 changes: 1 addition & 3 deletions docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ Dew
.. contents::
:local:

Dew is a lightweight, pragmatic command bus library for Go, designed to enhance developer experience and productivity.

The focus of this project has been to seek a way to simplify backend application development in Go, reducing the complexity of the code and cognitive load due to managing the dependencies, a cluttered interface, and mocking the dependencies for testing.
Dew is a command oriented interface library + Middleware System for Go. With the unified interface, we can be free from the cognitive load for maintaining different interfaces for each operation handler or domain logic.

.. _minimal-example:

Expand Down

0 comments on commit 9f5bb94

Please sign in to comment.