Skip to content

Commit 1a8bad1

Browse files
committed
Streamline unrelated introduction
1 parent 4b79587 commit 1a8bad1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/elixir/pages/anti-patterns/design-anti-patterns.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,11 @@ The following arguments were given to MyLibrary.foo/1:
298298

299299
#### Problem
300300

301-
Using multi-clause functions in Elixir, to group functions of the same name, is not an anti-pattern in itself. However, due to the great flexibility provided by this programming feature, some developers may abuse the number of guard clauses and pattern matches to group *unrelated* functionality.
301+
Using multi-clause functions in Elixir, to group functions of the same name, is a powerful Elixir feature. However, some developers may abuse this feature to group *unrelated* functionality, which configures an anti-pattern.
302302

303303
#### Example
304304

305-
A frequent example of this usage of multi-clause functions is when developers mix unrelated business logic into the same function definition. Such functions often have generic names or too broad specifications, making it difficult for maintainers and users of said functions to maintain and understand them.
305+
A frequent example of this usage of multi-clause functions is when developers mix unrelated business logic into the same function definition. Such functions often have generic names or too broad specifications, making it difficult for other developers to understand and maintain them.
306306

307307
Some developers may use documentation mechanisms such as `@doc` annotations to compensate for poor code readability, however the documentation itself may end-up full of conditionals to describe how the function behaves for each different argument combination. This is a good indicator that the clauses are ultimately unrelated.
308308

0 commit comments

Comments
 (0)