Hacker News new | ask | show | jobs
by putnambr 1130 days ago
Been doing this for a few years. If I have an `Item` class, it's going into its own package. Along with `ItemService` (business logic), `ItemResource` (endpoint), `ItemDao` (persistence interface), etc. If `Widget` has a dependency on `Item`, then `WidgetService can either import `ItemClient` or roll its own.

Makes it super easy to split out microservices when the monolith gets big. Just keep from injecting one Service class into another, rely on the Resource or Client instead.

1 comments

> WidgetService can either import `ItemClient` or roll its own

Can you clarify what is ItemClient in your context?