# Tool Abusers

Tool Abusers, also known as "object-oriented abusers", are a type of code smell that only occurs in object-oriented programming (OOP) languages. This code smell refers to incorrect or incomplete implementation of Object-Oriented concepts or principles.

> If the only tool you have is a hammer, you tend to see every problem as a nail. — Abraham Maslow

This is a famous quote commonly known as the "law of the instrument" or Maslow's Hammer. We sometimes over-rely on a familiar or favorite tool in the wrong way. "The code we write is a tool for producing future software," said Roman Kofman at RubyConf 2019. OOP may be the most powerful concept in the programming world. Billions of developers work with OOP every day, but not every line of code follows OOP principles properly.

As you may know, some developers have been criticizing OOP for decades, blaming it for various development challenges and inefficiencies. While it is true that certain pitfalls can arise in OOP, some of the criticism might just be pointing to code smells. It's important to recognize that these criticisms often arise from misuses and code smell issues rather than inherent flaws in the paradigm itself.

In my point of view, OOP, when applied correctly with adherence to best practices, can lead to highly maintainable, scalable, and modular codebases. These are ideas that are available in object-oriented programming that you may misuse.

#### Repeated Conditional Complexity

When you encounter complex "switch" statements or sequences of "if" statements in your code, it's a sign of this code smell.

#### Refused Bequest

When a class unnecessarily inherits code from its parents.

#### Alternative Classes with Different Interfaces

It appears that two different classes are performing similar responsibilities, but have different interfaces (method names, signatures, etc.).

#### Temporary Field

Fields in the Class that are used only by one Method or only under certain circumstances.

#### Reference

<https://bytelanguage.com/2018/02/25/code-smells-object-oriented-abusers/>

<https://refactoring.guru/refactoring/smells/oo-abusers>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://smells-to-refactorings.gitbook.io/smells/tw/tool-abusers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
