Monday, 4 April 2016

Introducing Xamarin Workbooks

The first public demonstration of Xamarin's new Workbooks idea was Miguel de Icaza's //build 2016 talk "Mobile First" (although he first wrote about it back in February). In his talk, Miguel demonstrates a new take on interactive documentation in which a Markdown-formatted file can live-execute C# code-fenced blocks; not just in-line but also in an iOS or Android simulator.



This opens up a great opportunity to write and share interactive documentation that not only describes an API or feature, but shows it in action. Further, it's easy to write, being based on the well-known Markdown format.

Give it a try!

You can now try Workbooks for yourself! The editor can be downloaded here, and there is some Workbook documentation on the Xamarin developer portal.

I've thrown together a few very simple ideas on github:

See Miguel's talk (if you didn't already) for a really cool demo.

Some Notes


  1. They're written in Markdown, but with a .workbook file extension.
  2. Each file begins with a small JSON-formatted metadata section. The editor will add this for you.
  3. C# code inside triple-backtick code fences will be executed when the file is viewed in the Workbooks editor. 
There's sure to be other resources popping up now that the project preview is publicly available -- Ben Bishop's video is the first community resource I've seen. Can't wait to see what everyone creates with it!

8 comments:

  1. How about integrating this work with Jupyter to get a Xamarin-based kernel for that working? That would provide a more powerful combination of Markdown and C# code interactive code development.

    ReplyDelete
    Replies
    1. I should probably qualify what I mean as more powerful, since there's some nice code-completion here. Having a web-based interface provides potential for collaboration and running, for example, spark code against a cluster, which doesn't appear as readily possible here. There's good integration with particular charting libraries in the Python and R back-ends, too, so you can easily produce charts to visualise the data. I use both sometimes to explore data, but my primary language is C# so I've been looking for options that provide the capabilities I have there with the familiarity of C#.

      Delete
    2. I agree a web-based version would be nice - ditto for rendering options like chating. otoh Xamarin is all about mobile and the ability to drive local iOS and Android devices from the workbook is great for our customers. This is still a pre-release product, so please give it a try and continue to provide feedback - as you said below, "hopefully all languages will have these kinds of workbook/notebook/worksheet some day"!

      Delete
    3. Based on the look of the interface I assumed this WAS Jupyter until I headed to the documentation and found no mention of it.

      Delete
  2. Looks really good. =)

    Is it limited to C#? To .NET languages? Or is it in any way extendable to other languages? I'm a C# fan but I find myself writing a lot of TypeScript these days.

    ReplyDelete
    Replies
    1. Looks like C# only at the moment. If you want something similar for Python, Scala or R (or a number of other languages) then check out Jupyter. Haven't seen any TypeScript support there either, though, yet. F# isn't a surprise, because you've had a good interactive prompt there for some time so there's been less of a need for something better, but hopefully all languages will have these kinds of workbook/notebook/worksheet some day...

      Delete
  3. Thanks for the link to my video, Craig. Today I posted another video on how you can add Nuget packages to your Workbook and do things like document how to consume a Web API:
    https://brax.tv/lesson/doc-apis-xamarin-workbook-nuget/

    ReplyDelete
    Replies
    1. I saw that! Nuget interaction was the next thing on my list - if I get around to it I'll be sure to share your video too. Great stuff.

      Delete