Building a large scale JavaScript application in TypeScript Alexandru Dima Microsoft.

Slides:



Advertisements
Similar presentations
Web Toolkit Julie George & Ronald Lopez 1. Requirements  Java SDK version 1.5 or later  Apache Ant is also necessary to run command line arguments 
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
CHAPTER 15 WEBPAGE OPTIMIZATION. LEARNING OBJECTIVES How to test your web-page performance How browser and server interactions impact performance What.
Java Script Session1 INTRODUCTION.
JavaScript and OSGi Simon Kaegi, Orion Project Co-lead IBM
Nov 23, 2014 Sofia var title = “RequireJS - a brand new world!”; var info = { name: “Bogoi Bogdanov”, otherOptional: “Managing Partner at Empters Ltd.”
patterns TypeScript size interface IModelChangeAccessor { insertText(position:IPosition, text:string): IEditorPosition; deleteText(range:IRange):
North Shore.NET User Group Our Sponsors. North Shore.NET User Group Check out our new web site Next Meeting
Client Side Dev. Toolkit HTML5 JavaScript CSS (and Less, but not today) Bootstrap Knockout.js Require.js (moving to Browserify) Toastr Visual Studio and.
What is it? –Large Web sites that support commercial use cannot be written by hand What you’re going to learn –How a Web server and a database can be used.
AVERSTAR GROUP September 6, 2001NASA Software IV&V Facility1 SIAT C++ CSIP Presentation.
ITM352 Javascript and Dynamic Web Pages: Client Side Processing.
Interesting facts about node.js.  Asynchronous I/O  How do they do that?..threads (usually) What do Web Servers do?
CASE Tools And Their Effect On Software Quality Peter Geddis – pxg07u.
Javascript and the Web Whys and Hows of Javascript.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Philly.NET Hands-on Labs JAVASCRIPT SERIES. July 9: JavaScript Syntax Visual Studio ◦Projects ◦Editors ◦Debugging ◦Script blocks ◦Minification and bundling.
Improving Program Performance Function Visibility in z/TPF C++ Load Modules October 2, /2/20151American Express Public.
Scalable Game Development William Roberts Senior Game Engineer
Introduction to TypeScript Sergey Barskiy Architect Level: Introductory.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
TypeScript Allan da Costa Pinto Technical Evangelist Microsoft.
AMD and RequireJS Splitting JavaScript Code into Dependent Modules Software University Technical Trainers SoftUni Team.
Canopy walk through Single-Page Apps (SPAs) Benjamin Howarth Freelancer, Code Gecko Umbraco UK Festival, Fri 30 th Oct 2015 CODE GECKO.
“RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments, like Rhino.
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Restricted © Siemens AG All rights reserved A Developer’s Insights Into Performance Optimizations for Mobile Web Apps CT DC AA EM LP2 | June 2015.
Bundles, Minification Andres Käver, IT Kolledž
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
TypeScript for Alfresco and CMIS Steve Reiner CTO Integrated Semantics.
TypeScript : All parts are good Andriy Deren CEO, Onlizer
Javascript Design Patterns. AMD & commonJS. RequireJS Marc Torrent Vernetta.
MICROSOFT AJAX CDN (CONTENT DELIVERY NETWORK) Make Your ASP.NET site faster to retrieve.
Mail Web Twitter TypeScript Rainer Stropek software architects gmbh JavaScript on Steroids.
1 Cutting Edge FE technologies for complex product August 6, 2015.
Node.js Modules Header Mastering Node.js, Part 2 Eric W. Greene
JQuery Fundamentals Introduction Tutorial Videos
Interfacing the Internet of a Trillion Things
Angular 4 + TypeScript Getting Started
Client Side Dev.
Node.js Express Web Applications
Modules, Babel, RequireJS, Other JavaScript Module Systems
Google Web Toolkit Tutorial
Introduction to Redux Header Eric W. Greene Microsoft Virtual Academy
Scripted Page Web App Development (Java Server Pages)
An In-Depth Look at the Autodesk® AutoCAD® App Autoloader Module
Michael Robertson Yuta Takayama Google Closure Tools.
9/13/2018 7:43 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
A lot of Software Development is about learning
SharePoint-Hosted Apps and JavaScript
Seamless Upgrade to Angular 5. Team at Google released the new version of angular that is Angular 5.0.0, pentagonal-donut. The main three insights that.
Angularjs Interview Questions and Answers By Hope Tutors.
JavaScript an introduction.
Microsoft Build /22/2018 6:07 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
TypeScript: Supersetting JavaScript
Accomplishing Executables
TechEd /18/ :08 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
Your code is not just…your code
4/25/2019 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Build 2014 Anders Hejlsberg Technical Fellow
Introduction to TypeScript
Introduce to Angular 6 Present by: Võ Văn Hào
Windows Azure Anders Hejlsberg Technical Fellow 3-012
Running C# in the browser
Blazor A new framework for browser-based .NET apps Ryan Nowak
Concepts in ASP.NET Core App
Your code is not just…your code
Presentation transcript:

Building a large scale JavaScript application in TypeScript Alexandru Dima Microsoft

What do we build? Web Standards based Developer Tools and Cloud Services

http90%10%

The Road to Monaco patterns TypeScript size

The Road to Monaco patterns TypeScript size

We enjoy programming in JavaScript

Pains Organizing a large and growing code base Need to come up with “compensating” patterns for classes and modules/namespaces Refactoring JavaScript code is difficult “JavaScript code ‘rots’ over time” “Writing JavaScript code in a large project is like carving code in stone” Describing APIs Keep the description in sync with the implementation

TypeScript to the rescue… Starts with JavaScript All JavaScript code is TypeScript code, simply copy and paste All JavaScript libraries work with TypeScript Optional static types, classes, modules Structural typing and type inference Enable scalable application development and excellent tooling Zero cost: Static types completely disappear at run-time Ends with JavaScript Compiles to idiomatic JavaScript Runs in any browser or host, on any OS

Demo

The Road to Monaco patterns TypeScript size

Code Organization Challenge Our modules were global variables and thereby open undisciplined name space contributions… Name spaces have no relationship to the actual files on disk Renaming files or name spaces is no fun… You can have cyclic dependencies without noticing…

Growing Pains: Managing dependencies …our dependency graph was such a mess that each area had a dependency on just about every other area. -- Ashamed Developer

Growing Pains: Order of scripts

Growing Pains: Eager script loading

AMD to the rescue… AMD = Asynchronous Module Definition A file is a module. A module declares dependencies and exports. define('id', ['moduleA'], function(moduleA) {​ // code goes here​ return {​ // exports​ }​; });

TypeScript supports External Modules Two different module types CommonJS – popular for NodeJS AMD – popular in browsers JS code differs depending on the module type Sharing code between AMD and CommonJS is difficult TypeScript is module type agnostic Uses compiler flag to generate different JS code

Demo

Post-AMD Migration It feels like fresh showered. Self contained modules, no more cycles, no more globals, clean file system structure. --Happy Developer

AMD Benefits – CSS dependencies Pain: global CSS files Want to split into multiple files Want to keep the CSS close to the JS that needs it Want to express CSS dependencies in code AMD loader plugins We implemented a css loader plugin, and TypeScript supports a pragma to generate non-TypeScript dependencies in the JavaScript code

AMD Benefits – Lazy Loading vs/languages/csharp.contribution modesExtensions.registerMode( ​ 'vs.languages.csharp', ['text/x-csharp'], ​ 'vs/languages/csharp', 'CSMode' ​ ); vs/languages/csharp export class CSMode { ​ constructor(…) { ​... ​ } ​ // lots of code... ​ } ​

AMD Benefits – Bundles Optimize # of server requests Bundle related modules together into one file Optimize the transferred size Load only modules that must be executed in the startup path We use r.js: UglifyJS:

The Road to Monaco patterns TypeScript size

Towards 100% TypeScript Migration happened out of developer will Migration is code clean-up but real work… Velocity around 300 LOCs per hour Team specific rules No implicit ‘anys’ No missing return types JSDoc comments

Towards 100% TypeScript In JavaScript, you really are at the mercy of your ability to spell: delete this.markers[range.statMarkerId]; Soon enough, I realized how inconsistent I was, the same data was flowing around in at least 3 different formats...

Components packaged as.js &.d.ts TypeScript language services We compile against a definition file, run against compiled version Our partners We package our modules to a set of.js files We generate a.d.ts describing public API Write lots of JSDoc

Services & Dependency Injection

TypeScript Retrospective We were on the bleeding edge… … but we expected it and had plenty of band aid We would do it again, the benefits outweigh the pains confidence, refactoring agility, tooling, fun From the beginning use TypeScript use external modules

Links Try us out for 1hr, no strings attached See more videos about Monaco Monacohttp://channel9.msdn.com/Series/Visual-Studio-Online- Monaco Try TypeScript