Published Feb 19, 2018

Clean Architecture - Make Your Architecture Scream

Michael, Joe, and Allen share best practices to improve coding quality and performance, delve into advanced email validation techniques, and provide practical tips for software developers to avoid common pitfalls.
Episode Highlights
Coding Blocks logo

Popular Clips

Episode Highlights

  • Validation Methods

    Email validation is a critical aspect of application development. Michael Outlaw emphasizes the importance of using the MailAddress class 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 MailAddress class 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