Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add case/switch statement code smell #49

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions _code_smells/case_or_switch_statements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
layout: code_smell
title: Case or Switch Statements
source: Martin Fowler
---

# Case or Switch Statements
Each language has a way of defining a nested block of code that controls what code is executed under certain conditions. They usually start with a `case` or `switch` keyword, but they could also be a list of `if/elif` conditions.

The problem is not necessarily with a case statement, switch statement, or a collection of if/else statements. **It's that these could hide duplication or an idea that wants to emerge.**

Often, the same switch statement is scattered throughout a program in different places. If you add a new clause to the switch, you must find and change all these switch statements.
5 changes: 5 additions & 0 deletions _data/contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,8 @@ ronheywood:
url: https://github.com/ronheywood
affiliation: Spektrix
member: no
chrismay:
title: Chris May
url: https://everydaysuperpowers.dev
affiliation: Everyday Superpowers
member: no
12 changes: 12 additions & 0 deletions society/contributors/chrismay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
layout: member
title: Chris May
author: chrismay
role: Technical Coach
---

# {{ page.title}}
{% assign author = site.data.contributors[page.author] %}
{{author.title}} is a {{page.role}} and a Python fanatic.

He is passionate about helping you enjoy programming more and living a better life. He writes at [Everyday Superpowers](https://everydaysuperpowers.dev) and runs [PyRVA](http://pyrva.org), the Python user group in Richmond, Virginia, USA.