UP | HOME

Platforms

kyleperik.com

I submitted my CatJam game, it's called Tower of Laputa, and I'm pretty happy about how it turned out, check it out! Oh and I added mobile support, not because I specifically wanted to, but because I happened to use a tall resolution and it would be weird if I didn't support it lol.

It was a great experience and I want to thank the people on the #uxn irc for helping me out and being a fun community to be apart of (even though I'm a lurker 90% of the time).

Now I'd like to share an idea here, it's not a new idea, but one I'd like to see more widely recognized and used.

To do so, we have to agree that understanding what a program does and how it works is the best way to get you to fixing and improving it. "What is does" is effectively the inputs and outputs of the program, (with the logic of the program describing what it does with those inputs and outputs)

Finding that out can be pretty difficult if IO interactions are strewn all over the place. Many programs you'll see in the wild can be modeled somewhat like this with respect to IO.

io_spaghetti.png

This can make it really hard to get a high level view of how your codebase interacts with the external world. It can sometimes take years before you learn every nitty gritty interaction that can take place in a legacy codebase.

This is especially problematic when downloading dependencies or applications on your computer. For this reason we've largely opted to rely on central authorities like package managers or app stores. Sometimes we'll use other heuristics of trust like stars on github.

But this really isn't ideal… we shouldn't just be users, consumers of software, but operators! We should always retain control of the software we use, without necessarily having to read it through line by line.

Instead I'll point to a solution: platforms

I'd describe a platform as a way to provide IO operations, without needing to target the implementation directly. It's like dependency injection (or inversion of control), but specifically for IO.

io_platform.png

The platform provides the set of operations, and means of interaction with the external world.

In adding this one layer of indirection, you do something kind of magical to your codebase. All your logic gains referential transparency, which is the fancy functional way of saying it is deterministic, providing the same output every time if given the same input.

While they technically may incur side effects by invoking the platform, I'd consider this more along the lines of something like Managed Effects, as all the inputs and effects are dispatched and dictacted soley by the platform.

What this means in practice is easy testability without mocks, and you can easily swap out the platform implementation following the same interface.

Sadly there's only one programming language I know of - roc - that fully integrates support for platforms (though not exactly in the way I've described).

By enforcing this priciple, it allows you as the operator to download libraries and applications that self document all the things it requires access to. As the operator, you can choose what you are willing to provide, or maybe you want it to ask permission for case by case, or what you might just want to log usage, that's all possible with platforms.

Beyond that, I'd like to see languages developed that enforce platforms use more dynamically, not just for the top level, but as a way to specify the "language" of the system, something that can be shaped and catered to each component as needed.

I hope in doing to unlock a new level of modularity and malleability that hasn't yet been seen in software.

I'll be exploring that concept in future blog posts so stay posted! It's a longer one, so thanks for reading to the end. If you have feedback for my writing or thoughts here, please don't hesitate to email me at: kyle [at] periks [dot] com