Skip to content

Commit

Permalink
Additional remarks for maintaining research history
Browse files Browse the repository at this point in the history
Similar to what we had already done with other anti-patterns that changed names
  • Loading branch information
lucasvegi authored Nov 6, 2023
1 parent 8ae45c1 commit 9cff297
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/elixir/pages/anti-patterns/design-anti-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ end

A common practice followed by the community is to make the non-raising version return `{:ok, result}` or `{:error, Exception.t}`. For example, an HTTP client may return `{:ok, %HTTP.Response{}}` on success cases and `{:error, %HTTP.Error{}}` for failures, where `HTTP.Error` is [implemented as an exception](`Kernel.defexception/1`). This makes it convenient for anyone to raise an exception by simply calling `Kernel.raise/1`.

#### Additional remarks

This anti-pattern was formerly known as [Using exceptions for control-flow](https://github.com/lucasvegi/Elixir-Code-Smells#using-exceptions-for-control-flow).

## Primitive obsession

#### Problem
Expand Down Expand Up @@ -294,6 +298,10 @@ The following arguments were given to MyLibrary.foo/1:
my_library.ex:2: MyLibrary.foo/1
```

#### Additional remarks

This anti-pattern was formerly known as [Working with invalid data](https://github.com/lucasvegi/Elixir-Code-Smells#working-with-invalid-data).

## Unrelated multi-clause function

#### Problem
Expand Down

0 comments on commit 9cff297

Please sign in to comment.