✅ improves readability and usability by hiding more complex interactions behind a common and simple interface
✅ provides a context-specific way to interact with a more general functionality
✅ It can be the initial change in a monolith to a more loosely coupled code
What tries to solve?
▫️ Make the subsystems easier to use
▫️ Merge logics and hidden into a more understandable method
▫️ Limit the logic exposed
👇
Example 1: We want to mimic an Uber app and to do so, we need a way to draw a route on a map.
We can provide a simplified service to hide interactions with the map, create routes, parse coordinates, calculate the midpoints, fit to streets, etc.
Example 2: We need to scope an EmailService to specialized to send marketing emails to current customers 📧💌
We could create a MarketingEmail class with templates and validations of customers' emails. The class will use the original EmailService to send the email.
Example 3: We could limit the interaction to a whole component in a loosely coupled architecture.
Think about an Order microservice, with their own service to process orders and a repository. We could expose an OrderComponent with limited access to internal parts.
• • •
Missing some Tweet in this thread? You can try to
force a refresh