# Temporary Field

> Instance variables that are only used in certain situations.

- **Category**: Code Smells
- **Subcategory**: oo-abusers
- **Canonical URL**: https://designpattern.fyi/code_smells/temporary-field/

---

## Description
'**Intent**: Identify fields that are only used in certain methods or under specific conditions.

**Context**: You have instance variables that are only set and used in specific methods. This makes the class's state confusing and hard to understand.

**Solution**: Extract the methods and their temporary fields into a separate class using Extract Class.'



## Use Cases
Use when fields are only used in specific scenarios or methods.









---
**Reference**: [Original Source](https://refactoring.guru/smells/temporary-field)

