According to Google Translate, the title of this post means ‘Language’ in Chinese. I actually wanted to choose a longer phrase as the title of this post but I tend to be very skeptical about machine translation and how the message can get lost in translation.
Millions of lines of metaphorical groundwork later, in this post I will share the terms I have used in the context of RAA. For many of you familiar with practices of Domain Driven Design, this terminology contract is nothing but agreeing on a ubiquitous language. Before we get into details, I invite you to think about a good-old radio station. Normally, you can turn on a radio virtually anytime and start enjoying it if there is a program on-air at that time. But programs usually are different from day to day and some programs may be replayed a few times for the audiences who might missed the original airing. You can also try and dissect one single program more to find out that in many cases a program is consisted of several segments (for example the main program along with the commercial breaks).
Figure 1 shows the main domain objects of our radio and how they are related to each other. Every day (starting 12am local time), RAA iterates over a lineup and plays it. Each lineup is consisted of multiple program boxes.
What a box resembles is similar to the notion of work shifts in a factory. The work in each shift is carried by a team and while they have control over their own work, they are (almost) isolated from the other shifts. In our domain, a box is a group of programs with a specified start time and with the criteria that all the member programs play back to back of each other. Also, boxes should not overlap with each other.
Then comes the core of any radio station, the programs. Programs sets the boundaries of a complete meaningful radio program (GNU is not Unix, eh?). An example would be a talk-show you host every night in your radio. Like most if its kind, RAA support New Episode programs as well as Replays of other programs (see figure 2).
A program has several clips. Clips are individual audio files and RAA runtime will treat them just like a simple playlist and plays them one after another.
A keen eye will quickly complain and ask about shows and pre-shows and how they fit into the game. Well, these two creatures are addressing a very special type of program but took a lot of design effort, and validate the 80/20 rule for 10^53th time! Take a look at figure 3 if you are interested in these two concepts.
Let’s explain this in an example. Consider a news program (the show) that start at 8:00pm sharp. Now what happens if the program right before finishes sooner (say for example at 7:59). This is where we expect our radio to play a sound track, something to fill the gap, right? We call this clip the filler item. Now what happens if we want to play commercials right before the program (the pre-show) but we do not want to worry about the timing and those clips overlapping with the show itself? It is now clear how we do this: a show may be preceded by a pre-show, which as well is a set of clips, and the pre-show is guaranteed to be scheduled as close as possible to the the start time of the show but do not cross it.
OK! now that we are talking the same language, let’s move on to more technical challenges this radio had bring and how we addressed them (if at all!).