Enterprise TypeScript

14
Consulting/Training Jeremy Likness Principal Consultant @JeremyLikness Enterprise TypeScript

description

TypeScript is a superset of JavaScript. Designed to enable enterprise-scale application development, TypeScript compiles to pure JavaScript. It provides important features such as classes, modules, and interfaces. TypeScript helps improve the quality of code by generating well-known and widely accepted JavaScript patterns while providing powerful development-time type-checking and discovery. TypeScript runs side-by-side with existing JavaScript and supports the concept of type definition libraries that can describe existing libraries for use by TypeScript even if they are written in pure JavaScript. In this talk, Jeremy Likness will explore the use of TypeScript in enterprise-scale applications. He’ll discuss not only the technological benefits of TypeScript but also explore the impact to the software development lifecycle overall. TypeScript enables a development workflow that helps scale development teams, improves quality and decreases ramp-up time. It also encourages a logical approach to software construction that results in more reusable and easily maintainable code.

Transcript of Enterprise TypeScript

Page 1: Enterprise TypeScript

Consulting/Training

Jeremy Likness

Principal Consultant

@JeremyLikness

Enterprise TypeScript

Page 2: Enterprise TypeScript

Consulting/Training

consultingWintellect helps you build better software, faster, tackling the tough projects and solving the software and technology questions that help you transform your business. Architecture, Analysis and Design Full lifecycle software development Debugging and Performance tuning Database design and development

trainingWintellect's courses are written and taught by some of the biggest and most respected names in the Microsoft programming industry. Learn from the best. Access the same

training Microsoft’s developers enjoy Real world knowledge and solutions

on both current and cutting edge technologies

Flexibility in training options – onsite, virtual, on demand

Founded by top experts on Microsoft – Jeffrey Richter, Jeff Prosise, and John Robbins – we pull out all the stops to help our customers achieve their goals through advanced software-based consulting and training solutions.

who we are

About Wintellect

Page 3: Enterprise TypeScript

Consulting/Training

Long, long agoSeriously, we’re talking decades In a galaxy far, far away … OK, so not that far away …Someone got the bright idea that they would

write a new language in just 10 days“I shall call it … Mocha! No, wait …

LiveScript … or, let’s make it even more confusing … JAVASCRIPT!Muwahahahahahahahah”

Once Upon a Time …

Page 4: Enterprise TypeScript

Consulting/Training

[] + [] = ?

[] – [] = ?

[] + {} = ?

[] – {} = ?

Array(5).join("Cool");

Array(5).join("Cool" + 1);

Array(5).join("Cool" – 1);

Here’s What We Were Left With …

Page 5: Enterprise TypeScript

Consulting/Training

Lightweight Scripting Language Easy to LearnRuns in Every Browser Dynamic by Nature Object-basedBuilt from day one to understand JSON Just making sure you were awake

The Pros of JavaScript

Page 6: Enterprise TypeScript

Consulting/Training

Lightweight Scripting Language … asked to do heavyweight work on the client

Easy to Learn think you’ve learned itRuns differently in Every Browser Dynamic by Nature Object-based … prototypical, which is a con

when you are expecting object-orientedLet’s go back to pros … it thankfully doesn’t

do well with SOAP

The Cons of JavaScript

Page 7: Enterprise TypeScript

Consulting/Training

Now we have to learn another language that behaves completely differently. Hoisting just doesn’t make sense and is only useful for JavaScript show-offs to stump their C#-loving enemies.

Once you finally learn to use === instead of == some API returns “2” instead of 2 and everything breaks

It’s tough to trust an API that takes any number of parameters without complaining

It insists on a camel-case convention and then doesn’t complain when you accidently use Pascal case

Function scope. Really? If I have to write another self-invoking function …

What is this? I now need a Mac and Windows with 12 Virtual Machines just to test

every combination of platform and browser we’re going to support

The Enterprise at War

Page 8: Enterprise TypeScript

Consulting/Training

JavaScript is here to stay You can probably thank

smart phones HTML5 isn’t helping

things either Not even the servers are

safe with Node.jsIt’s OK, things are better

It’s Time to Bury the Hatchet

Page 9: Enterprise TypeScript

Consulting/Training

1995 – JavaScript ships 1995 – 2005 – Weeping and Gnashing of Teeth (although AJAX

was available in 1999, it wasn’t even called that until 2005) 2006 – John releases jQuery and $ will never be the same 2008 – Engine gets a V8 (Google) 2009 – Jeremy releases CoffeeScript 2009 – Ryan releases Node.js 2010 – v1 of Knockout.js released 2011 – ECMAScript 5.1 provides hope for standards 2012 – TypeScript released (Microsoft) 2012 – v1 of Angular.js is released (after 3 years of development) 2013ish – asm.js (Mozilla)

Important Milestones

Page 10: Enterprise TypeScript

Consulting/Training

function (e) { return e.idx; }e => e.idx;for (var x = 0; x < 5; x++) { var y = x*2; }for (var x = 0; x < 5; x++) { let y = x*2; }const pi = "delicious.";class MyClass { constructor(a,b) { public a = a; private b = b; } get factor () { return private(this).b * a; }}// generators // modules// … and much, much more …

ES6 – Living in Harmony

Page 11: Enterprise TypeScript

Consulting/Training

Types Enumerations Generics Interfaces and Interface Extension,

Implementation Optional Properties Classes with Inheritance Static and instance types Private and Public Modifiers Accessors Modules External Modules (node.js, require.js) Ambient Declarations

Introducing TypeScript

“Say hello to my little friend.”

Page 12: Enterprise TypeScript

Consulting/Training

Immediate reduction in defect rates Faster ramp-up for new developers Shorter time to learn new APIs Accelerated rate to get from “file -> new” to “story done”C# developers spend less time asking themselves, “What is

this?” Code is easier to understand and maintainSaying “refactor” no longer results in weird stares and

people trying to usher you into a back room Bottom line: Estimated 2 – 4x improved productivity.Before: Eight 2-Week Sprints. After: Four 2-Week Sprints.Before: 100 points / sprint. After: 250 points / sprint.

Case Study

Page 13: Enterprise TypeScript

Consulting/Training

TypeScript in Action https://github.com/JeremyLikness/LearnTypeScript

Types, Generics, Functions, Modules, and a lot of other stuff too!