Contribute Media
A thank you to everyone who makes this possible: Read More

Washing away code smells

Description

Does your code smell? Have a weird fragrance? It turns out code smells are a real thing and an amazing conceptualization of suboptimal design. This talk helps you identify code smells in Python. It also shows you how to wash them away by the technique of refactoring. You will learn the art of writing Pythonic, clean and maintainable code.

Code smells refer to the symptoms of problematic code design. Identifying different types of code smells is the first step to successful refactoring. I will talk through some classic examples:

  • Unnecessary long and complex code
  • Using mutable data structures
  • Uncommunicative naming
  • Coupled code

Knowing what to refactor, I will share a few learnings that lead to good quality code:

  • The boy scout rule: always leave the code cleaner than you found it
  • Pythonic data structures: Enum, Namedtuple
  • The art of naming
  • DRY and the separation of concerns principle

I will also share tips on using refactoring at your company, which includes convincing your product manager, looking out for code smells during code reviews, and employing automatic tools.

The speaker has previously presented on Talk Python To Me Podcast: https://talkpython.fm/episodes/show/150/technical-lessons-learned-from- pythonic-refactoring, and at PyCon.DE: https://www.youtube.com/watch?v=Yq9-b2JKUyU.

Details

Improve this page