We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Discussion on Best Practices for Function Usage in Elixir
166
clicks
Source: reddit.com
Author pico303 discusses their confusion regarding the recommended usage of many small functions in Elixir, as advised in the book Programming Phoenix LiveView. They use the example of a function that renders a bar chart but relies on several smaller functions to return simple values like strings. The conversation in comments suggests that while these small functions may seem redundant, they serve purposes like readability, teachability, and working around Elixir’s lack of native support for constants. Different viewpoints include the use of module attributes for constants, the function's intent making the code more readable, and possible compiler optimizations.
Related posts
© HashMerge 2024