#rich domain model

1 messages · Page 1 of 1 (latest)

lament rivet
#

martin fowler talks about anemic models where you have classes without any behavior and all the logic is in a service class. i see a lot of applications implement their service using anemic models where their classes are just data objects and the service contains all the logic. is this the common way to create a backend service?

i don't have a problem with this, but some people say it's not really OOP because your class can have data and behavior

upper ingotBOT
#

<@&987246399047479336> please have a look, thanks.

upper ingotBOT
#

Changed the category to Architecture.

#

<@&987246841693360200> please have a look, thanks.

haughty galleon
#

the service class pattern come from Domain Driven design

#

it's a common metholodology to locate business logic (behaviors)

#

and keep getters() and setters() as they are encapsulated in their entities

#

it contributes to separation of responsabilities

#

Entity -> refers to plain object
Service -> refers to some logic between entities