Learn More

Group Theory, or: How I Learned to Stop Worrying and Love Roku Development

Mark Pearce
Jan 21

Roku development gets a bad rap. How can someone used to modern web development start working on Roku apps, and how can a university math course help?

The university class that had the largest impact on my life was Abstract Algebra, but I’ll get back to that later.

In the Beginning, there were Web Apps

When I started at REDspace over six years ago, I was hired to fill a specific position as an AngularJS developer working on an internal project for a large media conglomerate. I had previously gained experience in front end web development, working with AngularJS, at a different company. My new role leveraged that experience and I was able to commit the first line of code to what became a multi-year project that eventually had over 10 people working on it. 

As the years went on, the project grew and eventually became a hybrid AngularJS/Angular app, and I was able to expand my knowledge of Angular-centric web development through conferences like NG-Conf and online courses. However, after almost three years, the client had other priorities, and the project was wrapped up. Although the company decided to go in a different direction with their internal project, they loved the work my colleagues and I at REDspace were doing, and wanted us to pivot to a new project – not just a single web application, but instead a whole platform, consisting of multiple teams working on a shared codebase, developing over a dozen applications that would cohesively work together.

It was a big idea, and things ramped up quickly. I was asked to lead one of the teams on the project, consisting of REDspace employees, and soon there were two more REDspace teams working on the platform, handling front end web development, as well as back end and dev ops work. After about two years, there were dozens of people worldwide working on the platform, and it was by far the largest and most complex web development project that I had been involved with.

However, due to some business decisions, it was soon decided that other existing tools would be used company wide, rendering the platform our teams had worked on for the past two years obsolete. 

At this point in my career, I had been developing or leading teams working on Angular web applications for over five years, and I was wondering what would be next for me. 

I didn’t have to wait long. There was an opening on the team at REDspace that was developing Roku channels for ViacomCBS, including MTV, Comedy Central, BET+, and Noggin, and I was asked to consider joining that team.

Difficulty Level: Roku

Roku development, whether it deserves it or not, gets a bad rap. When you do web development, you have so many tools to help you do your work: browsers with extensive dev tools, countless NPM packages of reusable components, hundreds of tutorials and online courses, and multiple well-supported frameworks to build a web page from.

Roku has none of that. You need physical hardware to run your programs—there is no emulator. While there are tools for observing the state of a Roku app and debugging, they do not have the same capabilities as web dev tools. Roku uses BrightScript, a proprietary language that is similar to Visual Basic. Many concepts common to modern software development are not available in BrightScript. Asynchronous programming, object-oriented programming, typing, package managers, build and deploy tools, etc. are not native to Roku development, and you need to jump through hoops to do what would be fairly straightforward in JavaScript.

So because of its reputation, when I was asked to work on Roku, I did wonder in the back of my mind what I got myself into. Would I be able to use any of my knowledge to contribute to the new project? Would I take months to learn a new language and not be productive? And a little bit of impostor syndrome as well. Would my colleagues see I wasn’t as good as they thought I was?

Math Lessons

Which brings me back to my 3rd year math course, Abstract Algebra. One of the topics taught in that course is Group Theory, where you have a set of items and an operation that can take any two of the items in the set, and it will always return another item in the set. A good example of a simple group is the set of integers and adding. Pick any two integers and add them, you’ll always get another integer.

A mathematician would define a group something like:

A group is a set G together with a binary operation on G, that combines any two elements a and b to form an element of G, in a way such that the following three requirements, known as group axioms, are satisfied: associativity, identity element, and inverse element.

… and then go on to define what the axioms are. The power of defining it so vaguely (so abstractly) is that if you formulate proofs using that definition, it could be applied to ANY group, no matter what the elements or operations are. 

Lightbulbs came on when I realized I could think of math as object-oriented programming. I saw that a group could also be like a object-oriented programming interface:

interface Group {

   elements: GroupElement[];

   operation(a: GroupElement, b: GroupElement): GroupElement;

}

Through that course, I truly understood what “abstract” meant—that ideas can be disassociated from concrete examples, and then applied to anywhere the base criteria was met. In other words, if I can change my point of view so that I see two situations in the same light, the lessons learned from the first can be applied to the second.

Full Speed Roku

This brings me back to my switch to Roku development. The skills and techniques I used doing web development did not, and will not go away, I just need to abstract the knowledge I gained from them so that I can apply them in a new situation. A Roku channel is basically like a web app with different components that have inputs and outputs that can be rendered. While styling and constructing them is different, positioning and colouring them isn’t that far of a stretch. Roku animations use keyframes where properties are interpolated over time—the same as CSS animations, just a different syntax. The more I changed my point of view to make my previous work line up, more was falling into place. 

The concerns I had about the switch like I wouldn’t be able to contribute to the project soon dissipated. Don’t get me wrong— there is a huge learning curve for Roku, but the more I could apply my existing knowledge, the more productive and capable I became.

One example of how my previous experience benefited our team was how we applied branding across the different channels. We have a single mono-repo for all the channels we oversee, and apply and override configurations for different brands to specify the look and feel of each channel. However, if, for example, a certain channel used a specific font, it would need to be changed in that brand’s configuration file for every text element in the whole channel. The same problem in a web application would be solved using CSS variables, so why couldn’t a similar solution be used in our case? We already had a means to replace things like the channel name via a preprocessing tool, so why not also set up a variable like “main_font” and apply that everywhere? If there was a specific brand that needed a different font, just set the replacement to use the correct font name. So that’s what we did. It helped standardize look and feel to be more consistent across brands, and made updating styling to be a simple, straightforward change in one place in the code.

Developing with Roku also had some pretty interesting side benefits. Since the community is so much smaller than anything in the web development sphere, a Roku developer can actually affect change for the whole community. Any given web dev probably isn’t going to make an impact on web development as a whole, but if you want, there are many opportunities to create or improve tools that are used by many Roku developers.

For example, I saw that there wasn’t much active support for automatic documentation generation. The project I was working on had lots of great comments describing functions in the BrightScriptDoc comment format, but there was no nice way to actually render those out to a readable format like HTML. So I built one! I rewrote a jsdocs plugin someone in the community had started (with permission) and added it as a package that could be installed easily through NPM. Brighterscript-jsdocs-plugin has been downloaded a few hundred times already (which isn’t a lot in the JavaScript world, but it’s probably a good chunk of the Roku developers!). Another thing I helped with was a rewrite of a Microsoft VSCode extension called BrightScript Function Comment, an extension that helps in initially creating those documentation comments in the correct format. There’s lots of opportunity in the Roku development community to help out other developers.

When asked to work on Roku, I didn’t know what to expect. I can tell you that it has been a great experience. I was able to join an awesome team, and contribute to their success. I learned a lot and stretched my skills so I could apply them in new and novel ways.

···

REDspace believes strongly in a learning culture and employee development. Employees are able to learn and evolve their skills over time as technologies and client needs change. Interested in being part of a growing team delivering world-class technical solutions? Check out our current job openings!

Job Opportunities

Check current job openings

Find Us

  • 1595 Bedford Hwy, Suite 168
  • Bedford, NS B4A 3Y4
  • Canada

Located in Sunnyside Mall, near Pete's.

View on Google Maps

Business Inquiries

Media & Entertainment

Learning

Defence