.NET DC Meetup – Prototyping On the Cheap

I was fortunate to attend the .NET DC Meetup last night (3/19/2019), with Steve Goguen talking about using F# and Linqpad with the title of: Prototyping on the Cheap.

Steve opened with a relevant clip from The Founder about the Speedee System; a film that details McDonalds and their change from a single location to becoming the franchise powerhouse it has.

In the scene, the McDonalds brothers prototype how to make the most efficient kitchen layout possible to ensure fast, reliable hamburger production. Previous to this Hamburgers took 30 minutes to make and deliver in Drive-Ins. After this, Burger production went to 30 seconds. It would have been prohibitively expensive to make the changes necessary for this without prototyping. Note the tools they use: a ruler, chalk, a ladder, and imagination:

Steve then went through how F#, with its minimalist approach to declaring types and data structures (like a hash of hashes), let’s you use the code itself to prototype the relationship between entities in a system. The example he used was the menu system for chipotle. I have almost no experience with F# and I found his example easy to follow.

Besides using F# Data Structures as a way to show off relationships between entities, Steve took us through Bogus, a library for generating data.

Up until this point, I had never heard of Bogus, and I have just one question where has this thing been all my life? I hope Steve shares his code examples, but Bogus coupled with F# makes it trivial to generate sample data (image from last night’s meetup below):

Steve Goguen, taking us through how you can seed Bogus with the same number to have a deterministic randomness.

From the image above, the F# used to generate fake data is on the left, with the result, in Linqpad, shown on the right.

From this demonstration, a few things stood out to me:
1. Linqpad’s Dump()method is really useful and reminds me of the Perl library Data::Dumper, except in Linqpad it can dump in full blown HTML.
2. As Steve says in his presentation, Bogus does really well if you let it generate random data without constraints. If you provide constraints (for instance, Bogus can generate random birthdates in a 20 year timeframe), then Bogus can take much longer to generate the data you need. One way around this is to generate the data once and then use that data as the data to randomly pull from.

In the Second Act, Steve goes over FsCheck, to which I have to ask again, where has this been all my life?

FsCheck allows you to generate random values of given types as inputs for your application and check whether or not it handles those random inputs well. In terms of Prototyping, FsCheck provides a quick way to sanely flesh out where your idea may run into data problems (or where your assumptions are too broad or narrow), and you can use it in Linqpad.

Steve then went over Reactive Extensions in C# with Observables, and how to use Observables to prototype showing changes when items are selected or de-selected, as a way to show stakeholders different options.

Finally, in Act Three, Steve showed us how to use all of this along with Linqpad’s built in UI controls and some extension methods to generate Winforms and Web UIs, In Linqpad.

Linqpad has a number of controls built in , and Steve showed us how we can use these controls to prototype a Winforms UI. But that’s not all; Steve also showed us how to use an extension method to Dump IHtmlString as HTML to Linqpad, along with pulling in Bootstrap and Jquery (and Dumping it with the glorious Dump() method, to prototype entire HTML interactions in Linqpad.

Steve Goguen, showing us how to create entire interactive webpage prototypes in Linqpad.

The entire talk was well put together and made me excited for Linqpad, F#, and those newfound (to me) prototyping libraries. Many thanks to Steve Goguen for speaking on this subject. If/When the slides and code snippets are released, I’ll update this post with links to them. For now, Steve’s site is here, here’s his Github and Twitter.

Leave a Reply

Your email address will not be published. Required fields are marked *