Dependency
noun
say it: “dih-PEN-den-see” /dɪˈpɛndənsi/
Something a class needs to do its job, such as a database, a clock 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.
public class OrderService
{
private readonly IEmailSender email; // a dependency
public OrderService(IEmailSender email) => this.email = email;
}
In a sentence
- “OrderService has two dependencies: the order repository and the email sender.”
Level: Journeyman · More OOP terms at this level
Updated