Washing away code smells

Loading

Follow to receive video recommendations   a   A


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.



Editors Note:

I would like to work with open source projects to create a branch of the tree with all of the best videos for your open source project. Please send me an email if you are interested.