It is time I coined a programming term: Blog Driven Design
Blog Driven Design is discovering code is too verbose to reasonably include in a blog post and is the additional work put into the design to trim it down to a blogable size.
A recent beta of Json.NET added schema support. While writing the blog post showing the new feature in action I discovered there was no quick way go from a string to a JsonSchema object.
using (JsonTextReader reader = new JsonTextReader(new StringReader(schemaJson)))
JsonSchemaBuilder builder = new JsonSchemaBuilder(new JsonSchemaResolver());
schema = builder.Build(reader);
Yuck. What looked ok in a unit test is now excessive and ugly. A short example is a good example in my opinion so the JsonSchema.Parse(string) method was added to hide that work away. The end result looked like this:
JsonSchema schema = JsonSchema.Parse(schemaJson);
Not only is the code example in the blog post much smaller and simpler but end users can use the new Parse method as well. BDD in action!
Behaviour Driven Development watch out, Blog Driven Design is coming for your initials