Junior — Middle
Which of the SOLID principles is applied in the context of using ApplicationContext?
sobes.tech AI
Answer from AI
In the context of using ApplicationContext in Java (for example, in Android), the Dependency Inversion Principle (DIP) from SOLID applies.
This principle states that high-level modules should not depend on low-level modules directly; instead, both should depend on abstractions. ApplicationContext acts as an abstraction through which components access resources and services without depending on specific implementations.
Example: instead of creating objects directly, you request them via ApplicationContext, which simplifies dependency replacement and testing.