Why you shouldn’t run from railway-orientated typescript
A round-up of top tips and interesting history of railway-orientated typescript from Robin Pokorný
Robin Pokorný is passionate about helping others integrate the functional programming approach into their work. At his company, Klarna, they have a golden rule when it comes to programming, which is to achieve maintainability and robustness, Robin aims to give other programmers the ability to do this by using railway-orientated typescripts.
A key point Robin circles back to throughout his talk is that code written in TypeScript is easier to maintain and audit, and it’s less prone to bugs. The code you write for the railway-oriented model will be easier to understand and maintain once it has been deployed to the production environment.
Robin is passionate about the topic and believes that one of the solutions to many of the problems programmers face with code is functional programming.
There are commonly two types of people when you bring up the words ‘functional programming:
- People that hear the words ‘functional programming’ and expect it to be super academic, so start running for the hills.
- Or those who use other functional languages and are happy with that and don’t want to change from what they already know.
The purpose of Robin’s talk is to show how to make maintainable code, where he explains typescript and why it’s important. Throughout his WebExpo talk, he even shows the audience his coding in real-time.
Let’s dive in with some top tips and engaging facts from Robin Pokorný when it comes to using railway-orientated typescript in your work.
- Scott Wlaschin invented railway-orientated programming, however, focussed his work on the F# community. Robin’s ideas are adapted to suit typescript uses.
- One of the benefits of writing code in TypeScript that developers might overlook is that it provides better error messages. This will help you write more robust code. When developing an application, writing code that has a high degree of robustness is essential.
- TypeScript will throw error messages when it detects that code might be problematic. This will allow you to fix the problem before it’s too late.
- Organise your code properly by using folders and proper naming conventions.
- Limit the use of dependencies to the minimum.
- Try to limit the use of long functions, as this can make your code less readable.
- Be consistent with your coding practices.
- If you’re developing an application that will be used by many people in the organisation, you should opt for TypeScript. This is because it’s easier to read and maintain the code.
Robin explains how we are able to combine these patterns that are tested and work and put it with typescript so that it’s something really beautiful and works well.
When you try something new for the first time you will often be very bad at it, so people avoid doing it, this will happen with FPTS, so his advice is to go home and try it for an hour and eventually you will see the benefits and write robust code.
Robin finishes by recalling a quote from Greg Satell, ‘Innovation is combination’ and highlights how relevant for programmers this approach today is.
In conclusion, during this talk for WebExpo it’s clear to see how knowledgeable Robin is on all things functional programming. People shouldn’t be automatically worried when programmers start talking about typescript in their work and it is worth following along with robin with the true-to-life examples he uses in the talk so that you too can get to grips with it and begin producing wonderfully robust and maintainable systems.