Skip to content

Service & Repository Pattern

Webber Wang edited this page Oct 1, 2020 · 1 revision

Services

Our application should delegate tasks to services. Services provide core domain logic to be used by the client. A service is domain language specific & has methods that conform to the application.

Our NodeService would have generic CRUD methods, but can also contain methods like swap nodes or move nodes, which is specific to our Tree/Node data structure.

A service does not have knowledge on how to persist data.

Repository

A repository is the layer between the database and the application. All HTTP calls should be made here instead.

Clone this wiki locally