Correctness Series: Frontend Websites and TypeScript

 Aug 16, 2021   Post By: Sam Nolan

This tutorial will teach you TypeScript

Correctness: TypeScript

Of all considerations of making software, software being correct is probably the biggest one.

This series of workshops and posts takes a deep dive into ways that you can verify correctness. Particularly, it looks into ways that we can improve correctness by use of modern technology and type systems.

This post is for people interested in learning new technology, and leaving you with a large amount of ways that you can ensure that the software that you build actually works, and are aware of technologies that are out there.

The Game

The Mythical Man Month claims that for most software projects, 1/3 of the time is spent in specification, 1/6th in Development, 1/4th in Integration Testing and 1/4th in System Testing. These ratios happen regardless of whether you plan for them. If you specify too little, you will have to make up for it later. If you don’t do enough testing early, you’ll have to do more testing later.

This means that it is important that you discover bugs would come up later quickly. A feature will often go through a workflow that looks like:

  • Feature is Coded
  • Unit Tests pass
  • Code Review passes
  • Integration Tests pass
  • System Tests pass
  • User Test pass

The problem is that the later tests are expensive and take longer than the earlier ones.

The aim of this workshop series, and a game you’ll get to play, is to move certain classes of bugs up this hierarchy. So that problems that would usually come up in integration tests come up in code review or even earlier.

The Roadmap

We’ll look through some ways that we can improve the processes and tools that we use to build software so that we can have a more fun experience. We’ll cover:

  • Typescript and Web Development
  • Rust and Systems Programming
  • Elm, Web Development and Functional Programming
  • Isabelle and Interactive Theorem Provers

Meanwhile, we’ll get you to try some pair programming in order to try more organizational ways of finding and correcting errors.

So you want to build a frontend?

To build a frontend, you will almost always need JavaScript.

Sadly, JavaScript has its faults. One of the major faults is a cycle that is all too common when developing. One develops a feature, finds that some runtime error occurs, goes back to fix it and repeats until the change you made actually works. This wastes time and just causes frustration.

Interestingly, this can be really easy to fix. The solution is to use TypeScript (or Flow, PureScript or Elm). TypeScript is a language that compiles to JavaScript. Meaning you code in TypeScript, and the code gets converted into JavaScript for your website.

If you know JavaScript, you already know TypeScript as TypeScript is a superset of JavaScript. This means that all JS code is also TypeScript code.

All TypeScript does is add the ability to use static types in your programming.

Lets get you some TypeScript. We’ll be creating a task manager that calculates how busy you are.

The tutorial for TypeScript can be found here.

Going Further

If you haven’t been convinced already, I hope you have been now. TypeScript is really easy to add to current projects.

This is only the beginning however, and we’ll cover other systems soon. Including ones where it’s impossible to write any runtime errors.

Can’t wait to see you there.

Categories: Workshop