-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tidying, grammar, and minor clarifications (#13)
* Tidying, grammar, and minor clarifications * Changelog for 1.2.1 * Update README for 1.2.1
- Loading branch information
Showing
7 changed files
with
125 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,12 @@ | |
# Django API Domains | ||
_Style guides for the API age_ | ||
|
||
| Version | Author(s) | Date | | ||
| ------------------------------------------------------------------- |-------------------------------------------|------------| | ||
| [1.2](https://github.com/phalt/django-api-domains/releases/tag/1.2) | Paul Hallett [email protected] | 10-06-2019 | | ||
| [1.1](https://github.com/phalt/django-api-domains/releases/tag/1.1) | Paul Hallett [email protected] | 09-04-2019 | | ||
| [1.0](https://github.com/phalt/django-api-domains/releases/tag/1.0) | Paul Hallett [email protected] | 01-02-2019 | | ||
| Version | Author(s) | Date | | ||
| ----------------------------------------------------------------------- |-------------------------------------------|------------| | ||
| [1.2.1](https://github.com/phalt/django-api-domains/releases/tag/1.2.1) | Paul Hallett [email protected] | 25-09-2019 | | ||
| [1.2](https://github.com/phalt/django-api-domains/releases/tag/1.2) | Paul Hallett [email protected] | 10-06-2019 | | ||
| [1.1](https://github.com/phalt/django-api-domains/releases/tag/1.1) | Paul Hallett [email protected] | 09-04-2019 | | ||
| [1.0](https://github.com/phalt/django-api-domains/releases/tag/1.0) | Paul Hallett [email protected] | 01-02-2019 | | ||
|
||
## Introduction | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,42 @@ | ||
# Domains | ||
|
||
A [domain](https://en.wikipedia.org/wiki/Domain_(software_engineering)) is a piece of software that provides distinct business value within the context of your application. | ||
A [domain](https://en.wikipedia.org/wiki/Domain_(software_engineering)) is a piece of software that provides a distinct **business** value for your application. | ||
|
||
Within the context of software, what this styleguide calls a `domain` is roughly an extension of what Django would call an `app`. Therefore a _business_ domain **should** have at least one distinct _software_ domain mirroring it. | ||
What this styleguide calls a `domain` is roughly an extension of what Django would call an `app`. Therefore a business domain **should** have at least one distinct software domain mirroring it. | ||
|
||
## Examples in this guide | ||
--- | ||
|
||
The examples in this guide will talk about a `book shop` that must share details about books. This can be modelled as a _domain_ called `books`, and as a _software domain_ also called `books`. | ||
> ### Examples in this guide | ||
We keep the key benefits of Django's `app` pattern - namely Django's [models](https://docs.djangoproject.com/en/2.1/topics/db/models/) to represent tables in a datastore, with an emphasis on **skinny models**. We also retain Django's ability to *package apps as installable components in other applications*. This allows domains to be easily migrated to different codebases or completely different projects. | ||
> The examples in this guide will talk about a `book shop` that shares details about books. | ||
> This can be modelled as a _domain_ called `books`, and as a _software domain_ also called `books`. | ||
--- | ||
|
||
This guide tries to keep the key benefits of Django's `app` pattern - namely Django's [models](https://docs.djangoproject.com/en/2.1/topics/db/models/) to represent tables in a datastore, but with an emphasis on **skinny models**. | ||
|
||
This guide also retain Django's ability to *package apps as installable components in other applications*. This allows domains to be easily migrated to different codebases or completely different projects. | ||
|
||
## Domain rules | ||
|
||
There are two high-level rules around domains: | ||
There are two major rules around domains: | ||
|
||
1. You **should** split a domain if it becomes too big to work on. | ||
|
||
As a rule of thumb is that a domain should allow between 4-6 developers (3 pairs) to comfortably work on it. If you find your developers being blocked by each other then it is time to consider splitting the domain or checking the software has not diverged too far from the styleguide. | ||
A domain should allow between 4-6 developers (3 pairs) to comfortably work on it. If you find your developers being blocked by each other then it is time to consider splitting the domain or checking the software has not diverged too far from the styleguide. | ||
|
||
--- | ||
|
||
2. You **should** adhere to the styleguide patterns in this document in order to maintain strong bounded contexts between your domains. | ||
|
||
This applies even in situations where you extract one domain into two domains to increase velocity, but they still have to maintain a dependency between each other. We have found that if you relax the bounded context between domains, the boundary will erode and you will lose the ability to work on them independent of each other. | ||
This applies even in situations where you extract one domain into two domains to increase velocity, but they still have to maintain a dependency between each other. We have found that if you relax the bounded context between domains, the boundary will erode and you will lose the ability to work on them independent of each other. | ||
|
||
|
||
--- | ||
|
||
> ### Protip | ||
> An example _software_ domain is provided in the same directory as this styleguide under [example_domain/](https://github.com/phalt/django-api-domains/tree/master/example_domain). | ||
An example _software_ domain is provided in the same directory as this styleguide under [example_domain/](https://github.com/phalt/django-api-domains/tree/master/example_domain). | ||
--- | ||
|
||
Next, we will discuss the styleguide in detail. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
# Pin against a version | ||
|
||
In software we often specify a version of a project to use. | ||
In software we often specify a version of a project to use. For example - `requests==1.2` - this says _"we want to use requests version 1.2"_. | ||
|
||
For example - `requests==1.2` - this says _"use requests version 1.2"_. | ||
|
||
For this guide, we recommend the following picking a specific version and working against it. Just like software; future versions of this guide could change and that would mean conflicting issues with the styleguide in your projects. | ||
For this guide we recommend the following: picking a specific version and working against it. Just like software; future versions of this guide could change and that could cause conflicting issues with the styleguide in your project. | ||
|
||
You can see the released versions [here](https://github.com/phalt/django-api-domains/releases) and by clicking on the tag icon you can view historical versions. The published version at [https://phalt.github.io/django-api-domains](https://phalt.github.io/django-api-domains) will always be the latest version. | ||
|
||
# Be pragmatic | ||
|
||
Don't blindly follow what other people have written down. Sometimes it might not be suitable for your own problem. Use this guide as inspiration and guidance, but make your own decisions with your team when you aren't satisfied with it. | ||
|
||
Just make sure you keep track of any additional rules you create. | ||
--- | ||
|
||
> ### Protip | ||
> Keep track of any additional rules you make to keep your styleguide consistent! | ||
--- | ||
|
||
# Wording in this guide | ||
|
||
Sometimes this guide refers to the following areas in a domain: `interfaces`, `apis`, `services`, and `models`. You can assume any code examples are from the file name of the same area. E.g. - code examples under an `apis` heading is meant for the `apis.py` file. |