Time2Code: Functions as Service and Code as a Function

Jock Reed
3 min readAug 4, 2017

--

Over the last two years there has been a lot of talk about serverless functions. Although many smart people have created and implemented quite a few services with serverless functions, but we have still only scratched the surface on how we will change the way we live, work and code in this new serverless world. Services like AWS Lambda can be used for processing jobs and even for serving web pages as functions. One area we have not seen a lot of change from in a serverless function world is code learning and execution.

I have released a sleek, web based, code editor called Time2Code, turning Code Execution over to FaaS. I have been able to do this through Alex Ellis’ FaaS framework.

https://twitter.com/BretFisher/status/854849886868713473

I created this project because I couldn’t find an easy to deploy, free and open-source code editor, with code execution capabilities for multiple languages, that would run in a browser. I gathered a lot of my inspiration with what the Play-With-Docker team does to aide in educating and enable others with Docker and Kubernetes. I wanted to have the ability to build a code based learning tutorial without having to direct people to download specific IDEs or use a limited web based IDE service for quick code execution. What came out of this thought process, was a way to quickly execute short lived code on a service that can be deployed anywhere. From your laptop or your data center, inside Docker Swarm or Kubernetes, you can run Time2Code almost anywhere and deploy it within minutes.

The Time2Code web IDE comes with Python, Golang, NodeJS, and Powershell baked in, and more languages to come. You can easily and quickly submit your code snippets in the editor and use it to test your code or to test others’ code.

The real magic here is code as a function through the FaaS Framework. The hard part is not the editor, it’s the execution of the code with environments and dependancies, that is where FaaS comes in. It makes the code execution easy and scaleable by building the function as an embedded code executer.

The goal is to make deploying a web based code editor easier and more fun. I am looking to continually make this a great experience for learning and executing code and I hope you will enjoy it as well.

Call to action on the Time2Code project.

I need contributors in lots of forms. I need people to try it out, break it, make suggestions, raise issues, contribute code for more languages, etc. Go to the Time2Code on GitHub and follow the directions to try it out. If you come across something you think can be better raise an issue. If you want to tackle adding some languages or see something that could be better, fork the repo and do a pull request when you have it nailed down.

What’s next to be done for Time2Code…

  • Will have a page where you can integrate markdown tutorials from GitHub next to the code editor and terminal windows.
  • Adding support for C#, Ruby, and PHP.
  • Adding in support to make building in additional dependancies into code execution functions.
  • Improving error handling on the code execution functions.

Have fun, and Happy Coding!

--

--