droplets icon indicating copy to clipboard operation
droplets copied to clipboard

Question about Domain and external dependency

Open smoothprogrammer opened this issue 6 years ago • 1 comments

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?

smoothprogrammer avatar Jul 16 '19 08:07 smoothprogrammer

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.

spy16 avatar Jul 17 '19 09:07 spy16