Friday, 27 February 2009

System.Shell.CommandLine (storm in a teacup)

Miguel's post caught my eye because it seemed to contain thoughtful analysis of a .NET 4.0 'feature' that had appeared in the latest beta (Miguel later added the pre-script to his post - which sorta spoils the end of the story). I like Miguel's perspective on the framework (particularly the core) given his work on Mono and Moonlight.

I was a big fan of Mono.GetOptions when I first saw it, having included in in Searcharoo.net back in 2007. Now I discover that Miguel is
not a fan of using attributes for command line options. Attributes are just a poor language for expressing complicated semantics, they can only do well for setting simple flags, but once that is over, they become just as bad as the System.Shell.CommandLine interface...We tried that before, that was called "Mono.GetOptions" and we obsoleted it a few years ago, it was a cute idea, but did not map well for real world use.
I guess I better check out Mono.Options. Here's my GetOptions implementation for posterity (I thought the attributes were kinda cool, and more readable/maintainable than any other alternative at the time...)


Elsewhere on my reading list, Bart simultaneously posted an alternative opinion - some detailed examples of the .NET 4.0 code to help people understand it (not sure if he was aware it might not make RTM).

I enjoyed both perspectives, although tended to agree with Miguel's position - that it belonged on CodePlex rather than in the Framework. Was interesting to see his later update indicating that is exactly what would actually happen.

Bit OT for a blog post... but interesting to see the next release growing & changing

No comments:

Post a Comment