ElixirConf 2023 - Elaine Watanabe - Exploring code smells in Elixir

Explore code smells in Elixir and learn how to refactor your code to improve its design and maintainability. Discover 22 traditional code smells and Elixir-specific ones, and apply refactoring techniques to fix them.

Key takeaways
  • Code smells are symptoms of poor design that can harm the internal quality of Elixir systems.
  • Refactoring is a controlled technique for improving the design of existing code bases.
  • There are 22 traditional code smells identified by Martin Fowler in his book “Refactoring”.
  • Elixir-specific code smells include complex else clauses in with, multiple function clauses, and dynamic atom creation.
  • Refactoring techniques can be used to fix code smells and improve the design of Elixir code.
  • Some refactoring techniques include extracting functions, renaming variables, and moving code around.
  • Automated tools can help developers identify code smells and apply refactorings.
  • Developers should be aware of code smells and how to fix them to maintain a healthy and maintainable code base.
  • Refactoring is an ongoing process that should be done incrementally to avoid breaking the code.
  • Developers should focus on improving the design of their code over time to prevent code smells from accumulating.