Advent^2 of Code

Advent^2 of Code

Advent of Code is a nice way to get yourself to learn new programming languages. The Newton world offers an own unique challenge in the same style, quite a bit more complex though: I’ve been using the implementation of the Newton Docking Protocol as an experimentation playground. It has a number of quite interesting challenges!

Dynamic Data Structures

Data which is sent and received is stored in the Newton Streamed Object Format. The format is pretty straightforward to encode and decode, but one aspect makes it interesting: The objects are represented as a directed graph which can have cycles. This makes memory management of decoded structures a bit more complex.

Asynchronous Code

The Newton Connection Utilities (NCU) which are the traditional way to connect a Newton to a desktop computer allow not only simple tasks such as package installation or data transfer, but allow the user to also interact with the Newton while being connected. That requires handling two tasks at the same time: Dealing with the connection protocol which allows the Newton and the connected computer to initiate messages, and dealing with user interactions.

A fully featured tool to interact with the Newton needs to therefore handle multiple tasks at the same time.

Patterns

The implementation of a communications protocol is usually based on at least two more general software design patters: The protocol stack pattern for the overall structure where different protocol layers are interacting with each other, and the finite state machine pattern which structures the behavior of a single protocol layer.

Ideally, a programming language facilitates defining reusable patterns, and even better, a pattern library exists.

Cross Platform Support

Even though the Newton is an Apple product, it was always supporting Windows alongside MacOS for connectivity, and a connectivity app should likewise support at least macOS and Windows. With macOS support, Unix support is usually not far away either.

Usage and Installation

The Newton was designed as a personal digital assistant. As such, it hides technical complexities and is easy to use. A connectivity application should at least aim to be easy to use, and having a graphical user interface would be a key enabler. Additionally, installation should be as easy as possible across all platforms.

2022-05-01