Abstraction
Process of hiding implementation details and showing only functionality to user.
Implemented by
Abstract components like Interfaces and Abstract Classes.
How do interface and Abstract class achieve abstraction?
If you're returning an object through an API, you simply pass them an object of the interface, not the class.
The class(implementation) is useless information, the interface is all the consumer will need.
References
- Stack Overflow - How abstract class and interface achieve abstraction in java?
Typically, the approach is that you only show the user the interface of the object you're passing back to them, instead of the precise class that implements that interface. The interface is the essential implementation, the exact class is unnecessary information.
Children
Backlinks