Back to Academy
oop
Abstraction
Abstraction hides complex implementation details behind a simple, well-defined interface. Like how a car's steering wheel abstracts away the power steering pump, rack and pinion, and hydraulic lines — you just turn the wheel. Good abstractions let callers focus on what to do, not how it is done, reducing cognitive load and coupling.
Use Cases
- •Providing a simple send() method that hides SMTP configuration, retries, and templating
- •Abstracting database queries behind a repository with findById() and save() methods
- •Wrapping complex API authentication flows behind a single getClient() call
- •Hiding file system, cloud storage, or CDN details behind a unified Storage interface
Implementation
Output
Click "Run Code" to see output...