Originally posted by GreatEmerald
View Post
That said I was actually talking string parsing as a general input methodology, not just the command line args, but things like commands at a prompt (at least GUIs let me apply input masks), and loading in files. You can rather quickly devolve into parser hell where you're fighting off endless corner cases if you're having to read in a non-standardized or even broken formatting (I can only begin to imagine the pain of those who have to write parsers for HTML...) with documents that aren't well formed. Even worse if some asshat decided that he wanted to write all of the input by error-prone hand in a basic text editor instead of doing machine generation or at the very least a validating editor.
This is where XML and JSON come in, they're nice (and most importantly) strictly standardized data formats with serializers/deserializers available for most if not all of the important languages out there, and if you use data contracts in your classes things become even nicer still. Using DataContract{Json,Xml}{Serializer,Deserializer}s in C# is just awesome, all you have to do is annotate your class and it works, and really... what reason do you have with text files to not being using one or the other?
Comment