the journey from actionscript to typescript
Post on 14-Apr-2017
446 Views
Preview:
TRANSCRIPT
The Journey from ActionScriptto TypeScript
By Dan Gwynne
dan@gwynne.co.ukhttps://uk.linkedin.com/in/dangwynne
V 1.1
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
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
JavaScript
• In 2013 we started to look for alternatives to Flash…• JavaScript was the only choice
• 1000’s of lines of code in one file• Hard to govern the coding pattern• ES6 (ECMAScript6, ES2015)• Types
The problems with JavaScript
Solutions
• Strict Typing• Classes• Modules• Accessors• Type Definitions• JavaScript• Microsoft
TypeScript
Time to make the move?
• Merging of UI teams• Flash more mature product, Mobile needed the same quality• Typescript was proposed for Mobile
Just one small problem…
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
• 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…
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
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
• Increase in quality• Faster development time• Happier developers
Was it worth it?
• 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?
• TypeScript• Guarantees quality• Saves time• Creates happy developers• Assists us to react quickly to change• Helps us maintain our market leading position
To conclude…
The Journey from ActionScriptto TypeScript
By Dan Gwynne
dan@gwynne.co.ukhttps://uk.linkedin.com/in/dangwynne
top related