4 ms·
Except that one could unexpectedly/unintentionally pass "#@%^%#$@#$@#.com" to email function, but Email class works perfectly fine.
by majidazimi 9y ago
Except that one could unexpectedly/unintentionally pass "#@%^%#$@#$@#.com" to email function, but Email class works perfectly fine.
- crimsonalucard 9y agoSee my response to the other guy above. You want to validate an email? make a validation function. You don't need to put that validation function under a class then inject it into an object then send the mail. The email class does work fine. It's just full of extra cruft. Can you not see how the code is 10x more complex when you use DI patterns? To accomplish the task all you need is an implementation of an email function. That's it. This email function is replicated IDENTICALLY as a single method under the Email class, which indicates that all the classes, objects and dependency injecting that is surrounding the method are pointless abstractions over what already works.