Interactive Practice

Code Smell Challenges

Diagnose each design problem before revealing the suggested direction. Answers are saved locally.

Challenge 1

God Class

A StudentManager class validates students, saves them to a database, sends emails, calculates grades, and prints reports.

Challenge 2

Tight Coupling

OrderService creates a new StripePaymentGateway directly inside its constructor.

Challenge 3

Inheritance Trap

Bird has fly(), and Penguin extends Bird but throws an exception when fly() is called.

Challenge 4

Primitive Obsession

A payment method is represented everywhere by strings such as cc, paypal, and gift.

Challenge 5

Shotgun Surgery

Adding a new discount requires editing seven unrelated files.

Challenge 6

Feature Envy

InvoicePrinter reaches through an Order object to calculate totals, taxes, and discounts.