leveraging typescript in cross-functional development teams aaron mcgee, richard brookes m216

49

Upload: teresa-campbell

Post on 17-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216
Page 2: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Leveraging TypeScript in Cross-functional development teamsAaron McGee, Richard Brookes M216

Page 3: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Building Better Apps

Page 4: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

The JavaScript problem

Page 5: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Photo by Thomas Quilne, Flickr, Creative Commons Attribution 2.0 Generic

Page 6: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Solution: Enter TypeScript

Page 7: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Syntactic Sugar

Photo by Daniel Horacio Agostini, Flickr, Attribution-NonCommercial-NoDerivs 2.0 Generic

Page 8: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Basic Types

Page 9: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Basic Typesvar typeScriptBoolean: boolean = true;

var typeScriptNumber: number = 10;

var typeScriptString: string = "Hello World";

var anyOldType: any = "what evs";

Page 10: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Compiledvar typeScriptBoolean = true;var typeScriptNumber = 10;var typeScriptString = "Hello World";var anyOldType = "what evs";

Page 11: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Enums

Page 12: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Enumenum Color { Red, Green, Blue };

var c: Color = Color.Green;

Page 13: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Enum - Compiledvar Color;(function (Color) { Color[Color["Red"] = 0] = "Red"; Color[Color["Green"] = 1] = "Green"; Color[Color["Blue"] = 2] = "Blue";})(Color || (Color = {}));;var c = 1 /* Green */;

Page 14: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Arrays

Page 15: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Arrayvar list: number[] = [1, 2, 3];

var list: Array<number> = [1, 2, 3];

Page 16: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Compiles to:var list = [1, 2, 3];

Page 17: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Interfaces

Page 18: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Interfaceinterface ILabelledValue { label: string;}function printLabel(labelledObj: ILabelledValue) { console.log(labelledObj.label);}var myObj = { size: 10, label: "Size 10" };printLabel(myObj);

Page 19: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Compiles to:function printLabel(labelledObj) { console.log(labelledObj.label);}var myObj = { size: 10, label: "Size 10" };printLabel(myObj);

Page 20: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Function Types

Page 21: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Function Typesinterface SearchFunc { (source: string, subString:string): boolean;}var mySearch: SearchFunc;mySearch = function(src: string, sub: string) { //some implementation return true;}

Page 22: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Compiles to:var mySearch;mySearch = function (src, sub) { //some implementation return true;};

Page 23: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Classes

Page 24: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

TypeScript Class:interface ClockInterface { currentTime: Date;}

class Clock implements ClockInterface { currentTime: Date; constructor(h: number, m: number) { }}

Page 25: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Compiles to:var Clock = (function () { function Clock(h, m) { } return Clock;})();

Page 26: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Modules for organsiation

Page 27: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

TypeScript Modulemodule Time { export interface ClockInterface { currentTime: Date; } export class Clock implements ClockInterface { currentTime: Date; constructor(h: number, m: number) { } }

}

Page 28: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Compiles to:var Time;(function (Time) { var Clock = (function () { function Clock(h, m) { } return Clock; })(); Time.Clock = Clock;})(Time || (Time = {}));

Page 29: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Demo

Aaron McGee

Page 30: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Connecting Frontend and Backend

Photo by Ucumari Photography, Flickr, Attribution-NonCommercial-NoDerivs 2.0 Generic

Page 31: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Photo by daveynin, Flickr, Attribution 2.0 Generic

Page 32: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Photo by Ben Garney, Flickr, Attribution 2.0 Generic

When there’s duplication…

Page 33: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216
Page 34: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Demonstration

Richard Brookes

Page 35: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

…but there are still problems

Page 36: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Unifying Frontend and Backend

Photo by OneFuller, Flickr, Attribution-NoDerivs 2.0 Generic

Page 37: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Model Generation

Page 38: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Photo by Ubé, Flickr, Attribution-NonCommercial-NoDerivs 2.0 Generic

Page 39: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

The 3 stages of Model Generation Build Generate Repeat

Page 40: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Photo by NH567, Flickr, Attribution-NonCommercial 2.0 Generic

Page 41: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Demonstration

Richard Brookes

Page 42: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Conclusion

Page 43: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Try it for yourself

http://bka.co.nz/model-generation

Contact us:[email protected]@bka.co.nz

Page 44: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

The future of TypeScript generation?

Page 45: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Q&A

Page 46: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Related Ignite NZ Sessions

Building Azure Web Apps with Node.js and the Spotify Web API [M361]Thurs 4:30pm

Javascript on mobile - Cordova less of a (phone) gap than ever [M334] Wed 4:30pm

ASP.NET MVC vNext with Visual Studio 2015’s new tools [M364]Fri 9:00am

Universal Apps: A Developers Guide [M257]Wed 9:00am

Find me later at… Hub Happy Hour Wed 5:30-6:30pm Hub Happy Hour Thu 5:30-6:30pm Closing drinks Fri 3:00-4:30pm

1

2

3

4

Page 47: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Resources

TechNet & MSDN FlashSubscribe to our fortnightly newsletter

http://aka.ms/technetnz http://aka.ms/msdnnz

http://aka.ms/ch9nz

Microsoft Virtual AcademyFree Online Learning

http://aka.ms/mva

Sessions on Demand

Page 48: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

Complete your session evaluation now and win!

Page 49: Leveraging TypeScript in Cross-functional development teams Aaron McGee, Richard Brookes M216

© 2015 Microsoft Corporation. All rights reserved.Microsoft, Windows and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or

other countries.MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.