Split Loop Refactoring
Refactoring is a necessary skill. We're putting on a workshop at the end of month so you can learn to refactor like a pro.

I've been spending a lot of time lately with Emily Bache, Clare Sudbery, Nitsan Avni and Llewellyn Falco at very various Samman Coaching Events. Over that time I've picked up a variety of katas. Recently I learned the Split Loop kata from Emily. I created a LabVIEW version of the Theatrical Players Kata and recorded a quick demo.
The Kata
The Theatrical Players Kata consists of some code for generating a receipt/statement for a company that puts on plays. Each customer is associated with a set of performances. Depending on the type of performance and the number of tickets the pricing varies and there are also some discounts calculated.
The Dilemma
The thing driving this refactoring is that the theatre company wants to add a different type of report (maybe add .HTML or json) and also add different types of plays with different pricing schemes, so there are 2 different vectors of change. However, the code that handles both of these functions is all tied together in one loop, so we need to split it up first.
The Refactoring
There are several ways to split the loop. The easiest case is to duplicate the loop and delete what you don't need from each copy of the loop. Unfortunately that only works if the 2 halves are completely independent. When some of the calculated values from one half are needed in the other it gets more complicated. I show how to handle that in the youtube video.
Relevance to LabVIEW
Often I get pushback that some of the katas I borrow from Emily aren't relevant to what we typically do with LabVIEW. This one is very relevant to LabVIEW. In this kata, we are generating a report based on some input data. And as part of the report-generating process we are calculating a few things. Also, the client wants to change both the calculations and the report type. If you substitute test data for the information about the plays, it translates perfectly to the Test and Measurement world that we typically play in when we talk about LabVIEW. We're often generating reports in different formats and often calculating things and massaging the data as we generate the report.
Refactoring Workshop
I'm running a refactoring workshop at the end of the month. We'll practice this along with a bunch of other katas. You'll walk away with a bunch of tools to take whatever code base you have in whatever state it is in and modify it so you can make it easier to understand, maintain, and modify. Here's a little promo video I threw together. Use the button below to get tickets.