spy16 / droplets

Droplets is a platform for Gophers.
MIT License
321 stars 95 forks source link

Question about Domain and external dependency #10

Open minizilla opened 5 years ago

minizilla commented 5 years ago

In this docs, package domain cannot have a direct dependency on external packages. Why User domain import package golang.org/x/crypto/bcrypt? Any good reason?

spy16 commented 5 years ago

Answer for that is mentioned in Clean Architecture article under Entities section: "They are the least likely to change when something external changes".

Now if you consider x/crypto/bcrypt, this is an implementation of BCrypt algorithm which is well-defined and never going to change (Or, there is nothing external about it). This is in a way similar to using a package which is part of the standard library itself.