Project: the Polyglot
This is project is to be completed individually.
As usual, you should clearly cite the source of any code (or other content) you use from outside sources.
The goal of this project is to build a single system that uses multiple languages to do its work.
It is very difficult to quantify the “size” of a project, but it should be enough to justify marks for 26% of a 3rd year CMPT course. In particular for this project, you should have:
- several pieces of interacting functionality (which give us the excuse to use multiple languages);
- overall complexity that leads to a thousand to several thousand lines of code (while also noting that lines of code is a horrible way to measure complexity of software);
- complexity added by the technical challenge of getting multiple languages to work together;
- a system that can be easily deployed and actually works.
A couple of possible topics for the project can be found on the project ideas page. You do not have to choose from those ideas and are free to choose any topic if it meets the requirements specified below.
You project must be implemented using three different languages. The focus of the project will be cross-language implementations and communicating between languages. Some restrictions on your language choices:
- At least one “systems” language (like C, C++, Go, Rust).
- C and C++ count as one language.
- Only programming languages count toward your language count (e.g. not SQL, HTML, CSS, etc).
- Languages should be reasonably appropriate to the work done with them.
You must write a reasonable amount of code in at least two languages. The third language could be a library/package used by a foreign function call (or similar). That is, in one of your “implementation” languages, you can use logic in that language without writing it yourself (or you may need to write a few lines to get between the foreign function call and necessary library call).
You must use two different ways to communicate between languages your languages. These might include:
- A foreign function interface where you can somehow call a function from one language in another. If you search for “call language1 function from language2”, you'll probably find something (if it exists).
- A message queue such as RabbitMQ or ZeroMQ. The RabbitMQ tutorials give good RPC (remote procedure call) examples in many languages: you can use one language as the client and the other as the server.
- Create an RPC (XML-RPC or REST) server in one language and make a request to it from another. You can probably find an XML-RPC or REST library for either language and write relatively little code to connect them to your function/function call.
- A compiler toolchain that will compile both languages and let you call one from the other, like the GraalVM polyglot features or the various languages that compile to the JVM.
- Run the other language's code as an executable (exec and friends, or often a “system” function in many languages) and capture its output (stdout) into a string. Or have it write a temporary file and read it from the other program.
Implementation and Deployment
Your code must be in a repository on the CS GitLab server. Your final submission will be a tag in this repository that we will check out.
We need to be able to run your system to test it.
We have provided you with a template for the project that contains (mostly commented-out) setup for running code in many languages in a virtual machine. You can modify the setup recipe (
cookbooks/polyglot/recipes/default.rb) to install whatever tools you need so your system can run.
By the time you're done, starting the VM (with
vagrant up) should get your system into a runnable state. You may have a few components that need to be started by hand (like an RPC server). That is fine, but only one or two, and make sure they are clearly documented in your project summary (described below).
See the Project Deployment page for more information on working with the virtual machine and Chef recipes.
[This section is incomplete and will be filled in with some more information soon. The project template code will also get a few more examples. -GB]
In your project repository, include a file
cmpt383.md and briefly summarize:
- What is the overall goal of the project (i.e. what does it do, or what problem is it solving)?
- Which languages did you use, and what parts of the system are implemented in each?
- What methods did you use to communicate between languages?
- Exactly what steps should be taken to get the project working, after getting your code? [This should start with
vagrant upand can include one or two commands to start components after that.]
- What features should we be looking for when marking your project?
Create a Git tag (named
final or similar) in your project repository:
git tag final git push origin --tags
Submit a link to that tag in your repository through CourSys for the Project activity.