Which of the following are bad code smells? A) Multiple switch statements B) Using a…
- User
Which of the following are bad code smells? A) Multiple switch statements B) Using a variable for multiple purposes C) Descriptive variable names D) Data only classes E) Global data
Assistant
The code smells are:
A) Multiple switch statements B) Using a variable for multiple purposes D) Data only classes E) Global data
Explanation:
A) Multiple switch statements: Although switch statements are not inherently bad, having multiple switch statements in a single function or class can make the code harder to read, understand, and maintain. It can also indicate that the function or class may have too many responsibilities and should be refactored.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.