the journey from actionscript to typescript
TRANSCRIPT
![Page 1: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/1.jpg)
The Journey from ActionScriptto TypeScript
By Dan Gwynne
[email protected]://uk.linkedin.com/in/dangwynne
V 1.1
![Page 2: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/2.jpg)
bet365, first, some numbers
£34 billion annual turnover
£60 million annual IT budget
1.5 million markets on site
600,000 concurrent users
600 IT employees
18 Languages
15 Data centres
6 Flash UI Devs
![Page 3: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/3.jpg)
Flash, the end is near…
• 2005 - Introduced In-Play to the site using Flash ActionScript 2• 2011 - Full Flash desktop site using ActionScript 3• 2016 - Continues to be industry leading website
![Page 4: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/4.jpg)
JavaScript
• In 2013 we started to look for alternatives to Flash…• JavaScript was the only choice
![Page 5: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/5.jpg)
• 1000’s of lines of code in one file• Hard to govern the coding pattern• ES6 (ECMAScript6, ES2015)• Types
The problems with JavaScript
![Page 6: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/6.jpg)
Solutions
![Page 7: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/7.jpg)
• Strict Typing• Classes• Modules• Accessors• Type Definitions• JavaScript• Microsoft
TypeScript
![Page 8: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/8.jpg)
Time to make the move?
• Merging of UI teams• Flash more mature product, Mobile needed the same quality• Typescript was proposed for Mobile
![Page 9: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/9.jpg)
Just one small problem…
![Page 10: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/10.jpg)
No time to wait around
• Mobile In-Play needed to be completed by the end of 2013• In-Play was written in JavaScript with strict coding standards• Deadline was achieved
![Page 11: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/11.jpg)
• Was TypeScript still right for us• What problems would we be solving by migrating
• Difficult to maintain large codebase• Missing the features of strongly typed languages
• How would we approach converting 40,000+ lines of JavaScript?• Carefully• Code had good structure – one class per file• Namespacing• In-line comments
18 months later, decision time…
![Page 12: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/12.jpg)
How did we do it?
• We’re a team of coders!• Successfully converted 85% of the JavaScript automatically• Conversion rate was around 6,000 lines per day
![Page 13: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/13.jpg)
Did it work?
• Not only did it work it made the product better• Compared output to focus our test efforts• Manual QA team found zero bugs• 10 days to convert, fix, test, update build tools and deploy to
production
![Page 14: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/14.jpg)
• Increase in quality• Faster development time• Happier developers
Was it worth it?
![Page 15: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/15.jpg)
• Platform independent development environment• Quality through tooling – linting, unit tests, Selenium, test harness• Gaming product has adopted TypeScript • TypeScript 2.0 – check out TypeScript roadmap on github.com• Sportsbook rewrite
• Replace Flash Desktop site• Rewrite remaining Mobile site
• Rewrite benefits developers as well as customers…
What next?
![Page 16: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/16.jpg)
• TypeScript• Guarantees quality• Saves time• Creates happy developers• Assists us to react quickly to change• Helps us maintain our market leading position
To conclude…
![Page 17: The journey from ActionScript to TypeScript](https://reader036.vdocuments.net/reader036/viewer/2022070601/5887c5301a28abeb738b4f49/html5/thumbnails/17.jpg)
The Journey from ActionScriptto TypeScript
By Dan Gwynne
[email protected]://uk.linkedin.com/in/dangwynne