Which of the following is an indicator of a code smell?

Prepare for the Code Standards and Practices Level 1 Test. Test yourself with multiple choice questions, flashcards, and explanations. Ensure success with our comprehensive study materials!

Multiple Choice

Which of the following is an indicator of a code smell?

Explanation:
A code smell is a hint that there may be maintainability problems in the code, not a bug itself. Long methods are a classic indicator because they usually try to do too many things at once. When a method becomes lengthy, it’s harder to read, understand, and modify, which increases cognitive load and the chance of introducing mistakes. Splitting a long method into smaller, well-named pieces helps clarify intent, makes testing easier, and aligns with the principle of single responsibility. Comprehensive unit tests are a strong practice that improves reliability, not a smell. Clear module boundaries reflect good design and encapsulation, not a problem. Strong type safety enhances reliability and readability, also not a problem. So the best indicator among these is the presence of long methods.

A code smell is a hint that there may be maintainability problems in the code, not a bug itself. Long methods are a classic indicator because they usually try to do too many things at once. When a method becomes lengthy, it’s harder to read, understand, and modify, which increases cognitive load and the chance of introducing mistakes. Splitting a long method into smaller, well-named pieces helps clarify intent, makes testing easier, and aligns with the principle of single responsibility.

Comprehensive unit tests are a strong practice that improves reliability, not a smell. Clear module boundaries reflect good design and encapsulation, not a problem. Strong type safety enhances reliability and readability, also not a problem. So the best indicator among these is the presence of long methods.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy