21
HATE JAVASCRIPT? TRY TYPESCRIPT Ben Hoel(ng @benhnet b.hoel’[email protected]

Hate JavaScript? Try TypeScript

Embed Size (px)

DESCRIPTION

Many .net developers want to take advantage of JavaScript but struggle with the lack of tooling and language feature. This is especially true on larger, more-complex code projects. TypeScript can enable a .net developer to harness the capabilities of JavaScript while maintaining the tooling and syntax they prefer. This session will discuss some of the tooling advancements in Visual Studio 2012 related to JavaScript development. TypeScript is a new language developed by the creators of C# that compiles to JavaScript. The last portion of this session will dive into TypeScript and discuss some of the language features it provides on top of normal JavaScript. Between the IDE enhancements in VS 2012 and the language features of TypeScript, you will see that JavaScript development is not so bad.

Citation preview

Page 1: Hate JavaScript? Try TypeScript

HATE JAVASCRIPT? TRY TYPESCRIPT

Ben  Hoel(ng  @benhnet  b.hoel'[email protected]    

Page 2: Hate JavaScript? Try TypeScript

Ben  Hoel(ng  In  truth,  he’s  just  a  big  kid.  He  loves  designing  systems  that  solve  real  world  problems.  There  is  nothing  more  sa(sfying  than  seeing  something  you  helped  develop  being  used  by  the  end  users.  Ben  is  also  involved  in  the  technology  community  and  runs  the  South  Colorado  .NET  user  group.  He  also  enjoys  speaking  at  tech  groups  and  events  around  the  country.  

Ben  Hoel(ng  @benhnet  b.hoel([email protected]    

Page 3: Hate JavaScript? Try TypeScript

Agenda: v TypeScript Defined v What’s wrong with JavaScript v What’s right with TypeScript v TypeScript Basics v TypeScript and ASP.NET (Web Forms

and MVC) v TypeScript for Windows 8 Apps

Page 4: Hate JavaScript? Try TypeScript

TYPESCRIPT  DEFINED  v  A coding language that compiles to

JavaScript and provides strong typing and other modern coding language features

Page 5: Hate JavaScript? Try TypeScript

What’s  Wrong  with    JavaScript  

Page 6: Hate JavaScript? Try TypeScript

ISSUES  WITH  JAVASCRIPT  v  Dynamic Typing Leads to Run Time Errors v  Lack of Maintainability, Scalability v  Fine for Small Apps v  Takes Effort to Write and Learn how to

Write Clean Code v  Client Side JavaScript Coding is Different

Page 7: Hate JavaScript? Try TypeScript

What’s  Right  with    TypeScript  

Page 8: Hate JavaScript? Try TypeScript

TYPESCRIPT  ROCKS!  v  “Compiles” to JavaScript v  Provides Intent at Design Time v  Any Browser, Any Host (Node.js), Any OS v  Open Source + Tooling Support v  Static Typed v  Provides Encapsulation

v  Interfaces v  Classes v  Modules

Page 9: Hate JavaScript? Try TypeScript

TypeScript  Basics  

Page 10: Hate JavaScript? Try TypeScript

THE  BASICS  -­‐  AMBIENT  DECLARES  v  “declare” Keyword

Page 11: Hate JavaScript? Try TypeScript

THE  BASICS  -­‐  TYPES  DEFINITIONS  v  “:” To Force a Type Definition

Page 12: Hate JavaScript? Try TypeScript

THE  BASICS  –  FUNCTION  SIGNATURES  

Page 13: Hate JavaScript? Try TypeScript

THE  BASICS  –  INTERFACES  

Page 14: Hate JavaScript? Try TypeScript

THE  BASICS  –  CLASSES  

Page 15: Hate JavaScript? Try TypeScript

THE  BASICS  –  MODULES  

Page 16: Hate JavaScript? Try TypeScript

TypeScript  Basics    Demo  

Page 17: Hate JavaScript? Try TypeScript

TypeScript  and    the  Web  Demo  

Page 18: Hate JavaScript? Try TypeScript

TypeScript  and    Windows  8  Demo  

Page 19: Hate JavaScript? Try TypeScript

19

TYPESCRIPT  WRAP-­‐UP  

JavaScript’s  Shortcomings  

TypeScript  Basics   TypeScript  for  the  Enterprise  

JavaScript  is  dynamically  typed,  which  can  lead  to  run-­‐(me  errors.    Encapsula(ng  

JavaScript  is  difficult,  which  makes  it  hard  

to  us  in  large  applica(ons.    

TypeScript  is  a  superset  of  JavaScript.    It  

provides  sta(c  typing  to  improve  tooling  and  design-­‐(me  valida(on.    It  

provides  the  ability  to  encapsulate  your  

scripts.    

Tooling  for  TypeScript  is  

provided  for  ASP.NET  and  Windows  8  applica(ons  by  

installing  a  plug-­‐in  for  Visual  Studio.    

Page 20: Hate JavaScript? Try TypeScript

Resources:  v  http://www.typescriptlang.org v  http://msdn.microsoft.com/en-us/magazine/

jj983351.aspx v  http://msdn.microsoft.com/en-us/magazine/

jj870740.aspx v  Pluralsight Course v  http://blogs.msdn.com/b/typescript/ v  http://typescript.codeplex.com/wikipage?

title=Roadmap&referringTitle=Home

Page 21: Hate JavaScript? Try TypeScript

HATE JAVASCRIPT? TRY TYPESCRIPT

Ben  Hoel(ng  @benhnet  b.hoel'[email protected]