# Dependency

Something a class needs in order to do its job, like a database or an email sender.

## What is **Dependency**?

A **dependency** is something a class needs in order to do its job, such as a database connection, an email sender or a clock.

```csharp
public class OrderService
{
    private readonly IEmailSender email; // a dependency

    public OrderService(IEmailSender email) => this.email = email;
}
```

Level: Journeyman · [More OOP terms at this level](https://www.ask-codey.com/glossary/subjects/oop/journeyman)

Updated: September 27, 2026

## In other subjects

- [Dependency in C#](https://www.ask-codey.com/glossary/dependency-c-sharp)
- [Dependency in Java](https://www.ask-codey.com/glossary/dependency)
- [Dependency in JavaScript](https://www.ask-codey.com/glossary/dependency-javascript)

Source: https://www.ask-codey.com/glossary/dependency-oop
