SRP(PDF version; HTML version) states that
There should never be more than one reason for a class to change
When you take a look at Outlook, Calendar Event window, it has "Save and Close" button.
So when the functionalities of either or both Save or Close changes, that button should change. It obviously violates SRP.
This functionality both saves time and convinient since that is what most of users expect to do when they save an appoint on a calendar.
But now, my question is, when else do you violate SRP other than when the feature need to be usuable in Outlook?
SRP does not apply to UIs. Keep in mind that even though the button is called "Save and Close" there can undoubtedly be two separate methods or types to handle the saving and closing functionality. The button simply ties those two separate pieces of functionality together.
If you feel the need to violate SRP then you need to re-evaluate your approach. Any SRP violation can be refactored into a new method or type that exposes the composite functionality by means of composition of the two pieces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With