SRP Doesn’t Stand For “Several Responsibility Principle”

I know it should no longer come as any surprise to me, but I just found this method (and several others like it) lurking in a Data Access Object. Grrr…

/// <summary>
/// Send an email to notify that accrual data has been successfully uploaded
/// </summary>
/// <param name="accrualUpload"></param>
/// <param name="recipientAddresses"></param>
public void SendSuccessfulUploadEmail(AccrualUpload accrualUpload, Collection<MailAddress> recipientAddresses)

Much of software design / architecture isn't technically difficult, it just requires a little thought - "where does this functionality belong?"; - rather than forcing code into the first class you come across.

Square Peg in a Round Hole

Did I mention how useful NDepend is in exposing idiocy like this? I think I did. And I really should get round to blogging about how handy CodeRush and Refactor Pro are for cleaning up such smells.

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment