A black and white image of the author Kolja Dummann

Streaming, Contributing to MPS and Git Workflow.

Today I tried something new: I streamed while I was programming. Well, actually … I didn’t live stream it. I recorded it on the weekend and uploaded the unedited video file to Twitch. Mostly because my MacBook seemed to be sluggish when recording and coding. I might have solved that problem and do real live streams in the future.

In the stream I added a small feature to one of MPSs languages: MPS and other JetBrains IDEs contain a webserver that allows you to interact with the IDE from other processes. As a side project I would like to build a plugin for MPS that exposes the MPS models/programs via a REST API. In order to allow this I need access to the actual HTTP method that a request is using. At the moment MPS doesn’t expose this information to the user of their DSL which describes a handler for such HTTP requests. I decided that this might be a nice topic to stream about and so I did. You can watch the recording here:

In the video you see me exposing the HTTP method to the code in the request handler and changing the HTTP handler DSL to allow filtering for HTTP methods as a first class concept. To do so I had to change one of their generators and add new concepts to the DSL. In the stream I very briefly describe how to do this with MPS. But as MPS is a fairly complex tool and with a whole lot of aspects to keep in mind I tried to keep it short. I hope people can still get the idea and with some prior MPS knowledge might be able to implement something similar on their own. I cover all most all aspects that a concept in MPS has, from the structure over editor and typesystem to generators and give some hints how to build generators in a way that they are extensible.

In the end I opened a pull request at the official MPS repository. You can view it here.

As expected for a first, quite some things went wrong. For some reason the plugin that I use fto show the key strokes that I do started to display garbage. This never happened to me before although I use for over a year now. I also didn’t notice it during the recording but afterwards. Still not sure why that happened, I have to investigate that. I most probably want to do it live the next time to have a chance to interact with the people watching (if there are any 😉) in the chat.

Git Workflow

In the video I mention a “triangular” git workflow that I use. This is basically a setup where you have a readonly upstream repository, most probably because you are not (yet) a contributor to the project, a read/write fork and of course your local git repository. By default you pull from the readonly upstream and push to your writable fork. You can find a guide how to set it up here on the github blog.

Further Streaming Ideas

I haven’t really decided if I will continue to stream when I program but I already have some ideas what kind of things I could stream. Even as the side project about exposing models via a REST API is pretty interesting it is also really low level and mostly deals with the internals of MPS. I don’t think many would actually like to dig that deep into the tool. Especially given the fact that there aren’t that many MPS users compared to other more mainstream tools. Some of these ideas are:

  • setting up a build for a MPS project with gradle
  • writing a tiny language from scratch, maybe a small expression language
  • a walkthrough of the mbeddr platform/MPS extensions
  • extending the MPS DSL for defining languages (I know pretty meta 😎)
  • how to test languages and their different aspects
  • how to write extensible languages and especially generators

Do you would like see something about any of these? Leave comment with the topic you are interested in or some other thing you would like to see.

Do you have any other ideas, comments or feedback to the stream, audio/video quality or the content in general feel free to post them as a comment.