add explanation for the problem with atomic#47
Conversation
c1f3326 to
e4d64c0
Compare
e4d64c0 to
39ebff9
Compare
meshy
left a comment
There was a problem hiding this comment.
Thank you! I'm going to apply a few further changes just before merging:
docs/why.md
Outdated
There was a problem hiding this comment.
This sounds a little internal, so perhaps should be:
| 1. We create savepoints with decorators. *Linting for this is possible, but each existing case requires investigation.* | |
| 1. Indicating "this should be atomic" is often done by decorating functions with `atomic`. |
There was a problem hiding this comment.
Personally I think we can just simplify this:
| 1. We create savepoints with decorators. *Linting for this is possible, but each existing case requires investigation.* | |
| 1. Savepoints are created with decorators (`@atomic`). |
That point probably requires a bit of explanation, but we can add that when we revise this.
| ## Problems | ||
| 1. Django's atomic creates many savepoints that are never used. There are a couple of main causes: | ||
| 1. We create savepoints with decorators. *Linting for this is possible, but each existing case requires investigation.* | ||
| 2. `atomic` creates savepoints by default. The default arguments (*Behaviour* **A**) are an [attractive nuisance](https://blog.ganssle.io/articles/2023/01/attractive-nuisances.html) because they make us create savepoints when we don't need them. | ||
| > … if you have two ways to accomplish a task and one is a simple way that *looks* like the right thing but is subtly wrong, and the other is correct but | ||
| more complicated, the majority of people will end up doing the wrong | ||
| thing. | ||
| — [**Attractive nuisances in software design](https://blog.ganssle.io/articles/2023/01/attractive-nuisances.html) -** [Paul Ganssle](https://blog.ganssle.io/author/paul-ganssle.html) | ||
| > | ||
| 3. We have no easy way to indicate the creation of a savepoint that doesn't have the potential to create a transaction instead. The only tool we have to create a savepoint is *Behaviour* **A**, which can create a transaction. |
There was a problem hiding this comment.
I think this has got a bit mixed up in formatting.
| ## Problems | |
| 1. Django's atomic creates many savepoints that are never used. There are a couple of main causes: | |
| 1. We create savepoints with decorators. *Linting for this is possible, but each existing case requires investigation.* | |
| 2. `atomic` creates savepoints by default. The default arguments (*Behaviour* **A**) are an [attractive nuisance](https://blog.ganssle.io/articles/2023/01/attractive-nuisances.html) because they make us create savepoints when we don't need them. | |
| > … if you have two ways to accomplish a task and one is a simple way that *looks* like the right thing but is subtly wrong, and the other is correct but | |
| more complicated, the majority of people will end up doing the wrong | |
| thing. | |
| — [**Attractive nuisances in software design](https://blog.ganssle.io/articles/2023/01/attractive-nuisances.html) -** [Paul Ganssle](https://blog.ganssle.io/author/paul-ganssle.html) | |
| > | |
| 3. We have no easy way to indicate the creation of a savepoint that doesn't have the potential to create a transaction instead. The only tool we have to create a savepoint is *Behaviour* **A**, which can create a transaction. | |
| ## Problems | |
| Django's atomic creates many savepoints that are never used. There are a couple of main causes: | |
| 1. We create savepoints with decorators. *Linting for this is possible, but each existing case requires investigation.* | |
| 2. `atomic` creates savepoints by default. The default arguments (*Behaviour* **A**) are an [attractive nuisance](https://blog.ganssle.io/articles/2023/01/attractive-nuisances.html) because they make us create savepoints when we don't need them. | |
| > … if you have two ways to accomplish a task and one is a simple way that *looks* like the right thing but is subtly wrong, and the other is correct but | |
| more complicated, the majority of people will end up doing the wrong | |
| thing. | |
| — [**Attractive nuisances in software design](https://blog.ganssle.io/articles/2023/01/attractive-nuisances.html) -** [Paul Ganssle](https://blog.ganssle.io/author/paul-ganssle.html) | |
| > | |
| 3. We have no easy way to indicate the creation of a savepoint that doesn't have the potential to create a transaction instead. The only tool we have to create a savepoint is *Behaviour* **A**, which can create a transaction. |
docs/why.md
Outdated
There was a problem hiding this comment.
Personally I think we can just simplify this:
| 1. We create savepoints with decorators. *Linting for this is possible, but each existing case requires investigation.* | |
| 1. Savepoints are created with decorators (`@atomic`). |
That point probably requires a bit of explanation, but we can add that when we revise this.
docs/why.md
Outdated
There was a problem hiding this comment.
The formatting has gone a bit wrong here, perhaps an artefact of copying from Notion?
| — [**Attractive nuisances in software design](https://blog.ganssle.io/articles/2023/01/attractive-nuisances.html) -** [Paul Ganssle](https://blog.ganssle.io/author/paul-ganssle.html) | |
| — [**Attractive nuisances in software design**](https://blog.ganssle.io/articles/2023/01/attractive-nuisances.html) - [Paul Ganssle](https://blog.ganssle.io/author/paul-ganssle.html) |
Co-authored-by: Samuel Searles-Bryant <sam@samueljsb.co.uk> Co-authored-by: Lily Acorn <code@lilyf.org>
No description provided.