Best of…: Classic WTF: A Dumba... Note

Best of…: Classic WTF: A Dumbain Specific Language

This text discusses the creation of a domain-specific language (DSL) for defining "source" specifications. These specifications involve features and hierarchical steps, similar to a complex grammar. Instead of using XML with schemas for better structure and clarity, a previous implementation opted for a less robust solution. They created an XML schema rule that relied on an extensive regular expression to validate the data. This lengthy regular expression, totaling 1,310 characters, was intended to enforce the grammar rules. The author highlights that this approach proved problematic, leading to bugs. A specific bug necessitated a fix, with the author humorously referencing the negative consequences of such complex regex. The original grammar, along with its validation rules, is provided in both English and German. The text suggests that a more structured XML representation with proper schemas would have been a better, more maintainable approach. Ultimately, the attempt at a "labor-saving" solution through complex regex proved inefficient and error-prone.