Clean Architecture - Make Your Architecture Scream

Topics covered
Popular Clips
Episode Highlights
Validation Methods
Email validation is a critical aspect of application development. Michael Outlaw emphasizes the importance of using the
MailAddressclass in .NET for validating email addresses, rather than relying on regex patterns copied from the internet. This class not only validates the email format but also breaks it down into components like host, user, and display name 1. Alan Underwood adds that simply using a string and regex validator is not sufficient for robust email validation 2.  Â
Error Handling
Handling errors in email validation can be tricky. Michael suggests using a try-catch block to handle exceptions thrown by invalid email formats, ensuring the application can gracefully manage errors 3. He shares a personal anecdote about using Gmail's plus addressing feature, which often causes issues due to improper validation and encoding by many services 4. Alan points out that using the
MailAddressclass can help avoid these pitfalls by throwing exceptions for invalid formats 5.  Â
Real-World Challenges
The hosts share their personal experiences with email validation challenges. Joe Zack mentions the difficulty of uncovering obscure email addresses and rules that are not immediately apparent 6. Michael agrees, noting that many of these rules are only discovered through real-world testing and experience 7. Despite the complexity, Joe believes that experienced developers can often identify valid email addresses with high accuracy 8.
  Â
Advanced Techniques
Advanced email validation involves complex techniques like regular expressions and MIME types. Alan highlights the pitfalls of writing your own regex for email validation, noting that the official Perl regex for this purpose is 6499 characters long and still not foolproof 9. He advises against the DIY approach, as the official specifications are incredibly complex 10. Clever regular expressions in JavaScript might seem like a solution, but they often fall short of comprehensive validation 11.
Related Episodes

Clean Architecture - Fight for Architecture
Answers 383 questions

Clean Architecture - Programming Paradigms
Answers 383 questions

Clean Architecture - Are Microservices Truly Decoupled?
Answers 383 questions

Clean Architecture - How to Quantify Component Coupling
Answers 383 questions

Clean Architecture - Components and Component Cohesion
Answers 383 questions

Clean Code - How to Build Maintainable Systems
Answers 383 questions
Clean Architecture - The Art of Drawing Lines
Answers 383 questions

Clean Architecture - Keeping Your Options Open
Answers 383 questions

Clean Code - How to Write Classes the Right Way
Answers 383 questionsClean Code - How to Write Amazing Functions
Answers 383 questions

Clean Architecture - What is the Humble Object Pattern?
Answers 383 questions

Clean Code - Comments Are Lies
Answers 383 questionsClean Code - Formatting Matters
Answers 383 questions

Google’s Engineering Practices – Code Review Standards
Answers 383 questions

Why Domain Driven Design
Answers 383 questions
