dddshelf / ddd-in-php-book-issues

Leave your comments, improvements or book mistakes as an issue! Thanks ❤️
https://leanpub.com/ddd-in-php
28 stars 2 forks source link

Service named "SignUp" when it should probably be named "SignIn" #82

Closed shadyan closed 7 years ago

shadyan commented 7 years ago

In Chapter 5: Domain Services, specifically in the Domain Services and Infrastructure Services section, it talks about a SignUp service when I think it's supposed to be SignIn instead. The same misnomer also spills into the Testing Domain Services section.

Just to clarify the intent: The service makes sure that there is a User in the UserRepository with the provided username, and that the hash of the password of that user is the same as the hash of the "unencrypted password". Unless I'm missing some key point here I think the intent is singing in (authentication) of the user (the namespace of the implementation alludes to that: namespace Ddd\Auth\Infrastructure\Authentication;) and not signing up (registration) .

Another pretty strong clue is this snippet from the example of a Symfony DIC configuration:

<service id="sign_in.md5" class="Ddd\Auth\Infrastructure\Authentication\Md5HashingSignUp">
             <argument type="service" id="user_repository" />
</service>

(notice the id)

The classes and testing methods in the Domain Services and Infrastructure Services and Testing Domain Services sections of Chapter 5 should be renamed to SignIn instead of SignUp to not cause confusion.

If I had to guess I'd say this occurred because the previous section, Application Services, talked about a SignUpController and the name "SignUp" carried over, but the action changed.

keyvanakbary commented 7 years ago

@shadyan wow, thanks a lot! I'm a bit embarrassed on how messed up this thing was. I think we got confused with the sign up service example from other chapters. I fixed it all up, it should be published already 🙂 .

I wrote your name in the acknowledgments chapter too 👏

Cheers!

shadyan commented 7 years ago

Cheers. Big fan of the book.