ardalis / pluralsight-ddd-fundamentals

Sample code for the Pluralsight DDD Fundamentals course by Julie Lerman and Steve "ardalis" Smith
MIT License
901 stars 318 forks source link

Refactor Schedule.AddNewAppointment to abide by the CQS principle #47

Closed snowfrogdev closed 2 years ago

snowfrogdev commented 2 years ago

In practice AddNewAppointment is a command method, it has side effects and mutates the object. As such the CQS principle would want the method to not return anything. There isn't a single place in the app where we actually do anything with the returned Appointment. I figure we might as well mark the return as void.

I guess this change also follows the principle of least astonishment. I was 'surprised' to see this method return a value and a bit confused as to why, seeing as we didn't use that value anywhere. 🙂