My Wishlist for Playgrounds

Apple Playgrounds are amazing and for those that are using it know how it works best for them. Some use it for algorithms, some for testing code, etc. One of the reasons that I think playgrounds is important is the integration. The integration of commentary and code that make it seem more like an interactive book.
However the problems are not far behind.

The beauty of Playground

If you have never used playground, the awesomeness cannot be described in a couple of words or a picture. It is when you start to use it do you really realize the potential and amazing power it yields. You can type some code and playgrounds runs that code for you in the background and displays the resulting text in the right margins. Including the number of times a particular function was called, etc.

Problems with Playgrounds

The biggest problem with Playgrounds is the one that came with Xcode 6, it is unstable, buggy and if it were a rap star, it would be called, Sir-Crash-a-lot. However looking past that, there are some amazing things that you can do with playgrounds or rather expect to get done from playgrounds.

Wish List

The first expectation from playgrounds is to offer a mix/blend of HTML text (commentary) and live code. This is achieved quite wonderfully by Apple. There is a page that offers the details on the markup syntax to use. The guide can be found here.

When you want to use this functionality for teaching purposes, you would need to have options to create blocks, like versions. So you could have the iterations of your code that demonstrates how the code has grown. Currently since the whole file is executed, this is not possible. The compiler will fail at every error, spew errors if there are duplicate function names. However instead if there could be blocks that you could select to run, it would require a smalled portion of code to execute and could have a mix of buggy code (with errors to demonstrate why and how the compiler complains) and the fixed code in the next block.

The other thing that would be nice from Playgrounds is the ability to have better text formatting. Currently the way it works is, lines that do not have a physical line space between them would be displayed on the same line.

Screen Shot 2015-05-23 at 4.20.28 pm

If there was some way to pausing execution while you are typing code and know that the code could generate errors. So if there was control over the execution of playgrounds, it would be nice. There is an option to manually execute playgrounds if you want but none to pause execution.

Lastly with the markup and formatting, if it was also easy to switch between the raw markup and rendered, it would be easy to write formatted comments as against switching the rendering on and off.

These are a few of my favourite things (that I would want Playgrounds to have).

I believe this is not difficult. I recollect there were some code samples that used VB.Net to compile VB.Net text and execute it from this sample app, like a scripting language. There was another example where one could highlight (select) the text and compile only that bit. Which is what one might require in this case with Playgrounds. There could be a common block, code that is run for every block (mainly used for imports) and then different blocks that could be iterations or simply kitchen-sink samples.

Views All Time
Views All Time
Views Today
Views Today
Posted in Basics, Tip and tagged , .