ThreeDotsLabs / wild-workouts-go-ddd-example

Go DDD example application. Complete project to show how to apply DDD, Clean Architecture, and CQRS by practical refactoring.
https://threedots.tech
MIT License
5.14k stars 472 forks source link

Possibly violating SRP #5

Closed msamoylov closed 3 years ago

msamoylov commented 3 years ago

The single-responsibility principle might be violated here. Not sure if the NewTraining function should be doing validation routines.

https://github.com/ThreeDotsLabs/wild-workouts-go-ddd-example/blob/22c0a25b67c4669d612a2fa4a434ffae8e35e65a/internal/trainings/domain/training/training.go#L25

roblaszczak commented 3 years ago

Actually, it is expected 😉

This is ensuring that "The Second Rule of DDD lite: always keep a valid state in the memory" is met.