7 Python Code Smells: Olfactory Offenses To Avoid At All Costs

7 Python Code Smells: Olfactory Offenses To Avoid At All Costs

ArjanCodes

3 года назад

367,439 Просмотров

This video shows 7 code smells that point to poor design decisions, as well as how to fix them. I'm pretty sure you're guilty of at least one of these smells (as I was in the past :) ), and knowing these will help you write much cleaner, more robust code.

The code that I worked on in this video is available here: https://github.com/ArjanCodes/2021-code-smells.

💡 Here's my FREE 7-step guide to help you consistently design great software: https://arjancodes.com/designguide.

🎓 Courses:
The Software Designer Mindset: https://www.arjancodes.com/mindset
The Software Designer Mindset Team Packages: https://www.arjancodes.com/sas
The Software Architect Mindset: Pre-register now! https://www.arjancodes.com/architect
Next Level Python: Become a Python Expert: https://www.arjancodes.com/next-level-python
The 30-Day Design Challenge: https://www.arjancodes.com/30ddc

🛒 GEAR & RECOMMENDED BOOKS: https://kit.co/arjancodes.

A few interesting links to articles and books:
Refactoring: Improving the Design of Existing Code (2nd Edition) by Martin Fowler - https://amzn.to/35N4Clq
- Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides: https://amzn.to/3jllgyH
- Principles of Package Design: Creating Reusable Software Components by Matthias Noback: https://amzn.to/2NETK3l
- Clean Code: A Handbook of Agile Software Craftsmanship by Robert Martin: https://amzn.to/3qVZgNs

👍 If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!

💬 Join my Discord server here: https://discord.arjan.codes
🐦Twitter: https://twitter.com/arjancodes
🌍LinkedIn: https://www.linkedin.com/company/arjancodes
🕵Facebook: https://www.facebook.com/arjancodes

👀 Channel code reviewer board:
- Ryan Laursen
- Sybren A. Stüvel

🔖 Chapters:
0:00 Intro
1:27 Explaining the example
3:12 Code smell #1: imprecise types
5:52 Code smell #2: duplicate code
7:31 Code smell #3: not using available built-in functions
8:53 Code smell #4: vague identifiers
10:05 Code smell #5: using isinstance to separate behavior
13:40 Code smell #6: using boolean flags to make a method do 2 different things
15:58 Code smell #7: catching and then ignoring exceptions
17:29 Code smell #8 (BONUS): not using custom exceptions
21:30 Final thoughts

#arjancodes #softwaredesign #python

DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!

Тэги:

#code_smells #clean_code #code_smell #python_refactoring #code_refactoring #software_development #clean_code_tips #vscode_python_refactoring #code_refactoring_python #code_quality_metrics #software_design #python_code_smells #code_smells_python #bad_code_design #bad_software_design #python_software_development #python_software_making #python_software #python_refactoring_exercises #refactoring_python_code #code_smell_python #Code_smells_refactoring
Ссылки и html тэги не поддерживаются


Комментарии: