Skip to content

Commit b86b8ba

Browse files
committed
Clarify primitive obsession
1 parent e88377f commit b86b8ba

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ This refactoring is only possible when you own both modules. If the module you a
242242

243243
#### Problem
244244

245-
This anti-pattern happens when Elixir basic types (for example, *integer*, *float*, and *string*) are abusively used in function parameters and code variables, rather than creating specific composite data types (for example, *tuples* and *structs*) that can better represent a domain.
245+
This anti-pattern happens when Elixir basic types (for example, *integer*, *float*, and *string*) are abusively used in function parameters and code variables, rather than creating specific composite data types (for example, *tuples*, *maps*, and *structs*) that can better represent a domain.
246246

247247
#### Example
248248

@@ -260,7 +260,7 @@ Another example of this anti-pattern is using floating numbers to model money an
260260

261261
#### Refactoring
262262

263-
We can create an `Address` struct to remove this anti-pattern, better representing this domain through a composite type. Additionally, we can modify the `process_address/1` function to accept a parameter of type `Address` instead of a *string*. With this modification, we can extract each field of this composite type individually when needed.
263+
Possible solutions to this anti-pattern is to use maps or structs to model our address. The example below creates an `Address` struct, better representing this domain through a composite type. Additionally, we can modify the `process_address/1` function to accept a parameter of type `Address` instead of a *string*. With this modification, we can extract each field of this composite type individually when needed.
264264

265265
```elixir
266266
defmodule Address do

0 commit comments

Comments
 (0)