Code Smells - Refactoring.Guru

LES SOLDES D'HIVER C'EST ICI! / Refactoring Code Smells

— What? How can code "smell"?? — Well it doesn't have a nose... but it definitely can stink!

Bloaters

Bloaters are code, methods and classes that have increased to such gargantuan proportions that they are hard to work with. Usually these smells do not crop up right away, rather they accumulate over time as the program evolves (and especially when nobody makes an effort to eradicate them).

  • Long Method
  • Large Class
  • Primitive Obsession
  • Long Parameter List
  • Data Clumps

Object-Orientation Abusers

All these smells are incomplete or incorrect application of object-oriented programming principles.

  • Alternative Classes with Different Interfaces
  • Refused Bequest
  • Switch Statements
  • Temporary Field

Change Preventers

These smells mean that if you need to change something in one place in your code, you have to make many changes in other places too. Program development becomes much more complicated and expensive as a result.

  • Divergent Change
  • Parallel Inheritance Hierarchies
  • Shotgun Surgery

Dispensables

A dispensable is something pointless and unneeded whose absence would make the code cleaner, more efficient and easier to understand.

  • Comments
  • Duplicate Code
  • Data Class
  • Dead Code
  • Lazy Class
  • Speculative Generality

Couplers

All the smells in this group contribute to excessive coupling between classes or show what happens if coupling is replaced by excessive delegation.

  • Feature Envy
  • Inappropriate Intimacy
  • Incomplete Library Class
  • Message Chains
  • Middle Man
Refactoring.Guru
  • Contenu premium
    • Patrons de conceptionManuel moderne
    • Dive into refactoring
  • Patrons de conception
    • Introduction
      • Qu’est-ce qu’un patron de conception ?
      • Histoire des patrons de conception
      • Pourquoi devrais-je apprendre les patrons de conception ?
      • Critique des patrons de conception
      • Classification des patrons de conception
    • Catalogue
    • Patrons de création
      • Fabrique
      • Fabrique abstraite
      • Monteur
      • Prototype
      • Singleton
    • Patrons structurels
      • Adaptateur
      • Pont
      • Composite
      • Décorateur
      • Façade
      • Poids mouche
      • Procuration
    • Patrons comportementaux
      • Chaîne de responsabilité
      • Commande
      • Itérateur
      • Médiateur
      • Mémento
      • Observateur
      • État
      • Stratégie
      • Patron de méthode
      • Visiteur
    • Exemples de code
      • C#
      • C++
      • Go
      • Java
      • PHP
      • Python
      • Ruby
      • Rust
      • Swift
      • TypeScript
  • Refactorisation (commenter bientôt)
    • What is Refactoring
      • Clean code
      • Technical debt
      • When to refactor
      • How to refactor
    • Catalog
    • Code Smells
      • Bloaters
        • Long Method
        • Large Class
        • Primitive Obsession
        • Long Parameter List
        • Data Clumps
      • Object-Orientation Abusers
        • Switch Statements
        • Temporary Field
        • Refused Bequest
        • Alternative Classes with Different Interfaces
      • Change Preventers
        • Divergent Change
        • Shotgun Surgery
        • Parallel Inheritance Hierarchies
      • Dispensables
        • Comments
        • Duplicate Code
        • Lazy Class
        • Data Class
        • Dead Code
        • Speculative Generality
      • Couplers
        • Feature Envy
        • Inappropriate Intimacy
        • Message Chains
        • Middle Man
      • Other Smells
        • Incomplete Library Class
    • Refactorings
      • Composing Methods
        • Extract Method
        • Inline Method
        • Extract Variable
        • Inline Temp
        • Replace Temp with Query
        • Split Temporary Variable
        • Remove Assignments to Parameters
        • Replace Method with Method Object
        • Substitute Algorithm
      • Moving Features between Objects
        • Move Method
        • Move Field
        • Extract Class
        • Inline Class
        • Hide Delegate
        • Remove Middle Man
        • Introduce Foreign Method
        • Introduce Local Extension
      • Organizing Data
        • Self Encapsulate Field
        • Replace Data Value with Object
        • Change Value to Reference
        • Change Reference to Value
        • Replace Array with Object
        • Duplicate Observed Data
        • Change Unidirectional Association to Bidirectional
        • Change Bidirectional Association to Unidirectional
        • Replace Magic Number with Symbolic Constant
        • Encapsulate Field
        • Encapsulate Collection
        • Replace Type Code with Class
        • Replace Type Code with Subclasses
        • Replace Type Code with State/Strategy
        • Replace Subclass with Fields
      • Simplifying Conditional Expressions
        • Decompose Conditional
        • Consolidate Conditional Expression
        • Consolidate Duplicate Conditional Fragments
        • Remove Control Flag
        • Replace Nested Conditional with Guard Clauses
        • Replace Conditional with Polymorphism
        • Introduce Null Object
        • Introduce Assertion
      • Simplifying Method Calls
        • Rename Method
        • Add Parameter
        • Remove Parameter
        • Separate Query from Modifier
        • Parameterize Method
        • Replace Parameter with Explicit Methods
        • Preserve Whole Object
        • Replace Parameter with Method Call
        • Introduce Parameter Object
        • Remove Setting Method
        • Hide Method
        • Replace Constructor with Factory Method
        • Replace Error Code with Exception
        • Replace Exception with Test
      • Dealing with Generalization
        • Pull Up Field
        • Pull Up Method
        • Pull Up Constructor Body
        • Push Down Method
        • Push Down Field
        • Extract Subclass
        • Extract Superclass
        • Extract Interface
        • Collapse Hierarchy
        • Form Template Method
        • Replace Inheritance with Delegation
        • Replace Delegation with Inheritance
Connexion Nous contacter Refactoring.Guru Ma boutique
  • Français English Español Français 日本語 한국어 Polski Português Brasileiro Русский Українська 中文
  • Nous contacter
  • Connexion

Tag » Code Smells Examples C#