Data Service

Written by

in

Description

A service that exclusively performs information retrieval and typically provides only simple read operations. Often goes hand in hand with Feature Envy, because relevant functionality is not provided.

Context

Derived from: “Data Class”
This smell can, but does not have to, be applied to the provided model, depending on the used architectural style

Cause

Data and behavior should be tightly coupled in the same abstraction. If they spread across different components, then it is likely that an abstraction contains only data, whereas the behavior that requires that data lies in another abstraction.

Consequences

A data service may have a large number of operations with low cohesion, which can have a negative influence on maintainability.

Detection

Searching services that exclusively provide access to a data source (Business Object, Data Object or Artifact) and do not initiate interaction with other services. However, other services may use this service to retrieve data.

Solution

Move Method; Encapsulate Field

Example

A component only provides customer data and does not process those informations

Cypher query

MATCH p = (a)-[r:AccessRelationship]-(d) <br /> WHERE (a:ApplicationService or a:BusinessService or a:TechnologyService) AND (d:DataObject or d:BusinessObject or d:Artifact) <br /> WITH p, a <br /> WHERE NOT EXISTS{ <br /> (a)-[r1:AssignmentRelationship|CompositionRelationship|AssociationRelationship|AggregationRelationship|RealizationRelationship]-(s) <br /> WHERE NOT s:ApplicationService or s:BusinessService or s:TechnologyService <br /> } <br /> RETURN p

Cypher count query

MATCH p = (a)-[r:AccessRelationship]-(d) WHERE (a:ApplicationService or a:BusinessService or a:TechnologyService) AND (d:DataObject or d:BusinessObject or d:Artifact)  WITH p,a   WHERE NOT EXISTS{ (a)-[r1:AssignmentRelationship|CompositionRelationship|AssociationRelationship|AggregationRelationship|RealizationRelationship]-(s)  WHERE NOT s:ApplicationService or s:BusinessService or s:TechnologyService } RETURN count(distinct a)

Diagram

Diagram for Data Service

Aliases

Data Class

Tags

soa, microservices, business, application, cohesion, data management, between elements, The Dispensables, automatic detection

Related smells

All smells