Voltar ao glossario
Code Review e QualidadePopular

Code Smell

A surface indication in the source code that usually corresponds to a deeper problem in the system. Not a bug itself, but a sign that refactoring may be needed.

Definicao

The term "code smell" was coined by Kent Beck and popularized by Martin Fowler. Common code smells include: Long Methods (functions doing too much), God Classes (classes with too many responsibilities), Duplicate Code (copy-pasted logic), Feature Envy (methods that use another class's data more than their own), and Magic Numbers (unexplained numeric literals).

Por que e importante

Code smells indicate potential maintainability problems. While they don't prevent code from working, they make it harder to understand, modify, and extend. Studies show that code with multiple smells has 2-3x higher defect rates. Addressing smells early prevents technical debt accumulation.

Exemplo

A method has 200 lines and 15 parameters — this is a "Long Method" code smell. It suggests the method should be broken into smaller, focused functions.

Termos relacionados

code smellwhat is code smellcode smells examplescode smell definition

Automatize Code Review com diffray

Sistema de IA multi-agente para code review. Encontra bugs, vulnerabilidades de seguranca e problemas de arquitetura automaticamente.