Tuesday, April 1, 2014

Introduced FormEmailService façade and struggling with names again

Following the advice given by One on a comment, I introduced a façade service that encapsulate everything about emails, FormEmailService with FormEmailComposer and EmailSender as collaborators. This simplified the creation of the IntroducedInformation class which was great.

I also followed his suggestion of passing the form object as a parameter to the sendByEmailAndRedirect method.

This was how it was used after that change:

Although the creation of the IntroducedInformation got simpler, I didn't like how it read anymore because an "information thing" was now sending a form.

In the previous version the "information thing" was sending itself using a "Yoda-like" language:

To keep the form as a parameter I decided to rename the class to so it was "something that does something on something" and not finding any better name I went down the road of "SomethingService" names:

Well, it's not perfect but at least I think it reads better than the version where the "information thing" was sending a form.

This is how the class looks now:

and these are its tests:
I keep thinking in a name for this that doesn't follow the "SomethingService" pattern, but until inspiration comes I'll settle on this one.

Thank you very much Carlos, Marcin and José for your feedback. I really appreciate it.

No comments:

Post a Comment