Skip to content

add explanation for the problem with atomic#47

Merged
meshy merged 3 commits intokraken-tech:mainfrom
Amy-Franz:add-explination-for-the-problem
Sep 23, 2025
Merged

add explanation for the problem with atomic#47
meshy merged 3 commits intokraken-tech:mainfrom
Amy-Franz:add-explination-for-the-problem

Conversation

@Amy-Franz
Copy link
Contributor

No description provided.

@Amy-Franz Amy-Franz requested a review from a team as a code owner September 22, 2025 13:15
@Amy-Franz Amy-Franz force-pushed the add-explination-for-the-problem branch from c1f3326 to e4d64c0 Compare September 22, 2025 13:51
@Amy-Franz Amy-Franz force-pushed the add-explination-for-the-problem branch from e4d64c0 to 39ebff9 Compare September 22, 2025 16:34
Copy link
Collaborator

@meshy meshy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I'm going to apply a few further changes just before merging:

docs/why.md Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds a little internal, so perhaps should be:

Suggested change
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`.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think we can just simplify this:

Suggested change
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.

Comment on lines 20 to 29
## 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this has got a bit mixed up in formatting.

Suggested change
## 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think we can just simplify this:

Suggested change
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting has gone a bit wrong here, perhaps an artefact of copying from Notion?

Suggested change
— [**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>
@meshy meshy merged commit c323d6e into kraken-tech:main Sep 23, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments