TypeScript : All parts are good Andriy Deren CEO, Onlizer

Slides:



Advertisements
Similar presentations
The C ++ Language BY Shery khan. The C++ Language Bjarne Stroupstrup, the language’s creator C++ was designed to provide Simula’s facilities for program.
Advertisements

Programming Languages and Paradigms
Building a large scale JavaScript application in TypeScript Alexandru Dima Microsoft.
Objectives Introduction to Inheritance and Composition (Subclasses and SuperClasses) Overriding (and extending), and inheriting methods and constructors.
North Shore.NET User Group Our Sponsors. North Shore.NET User Group Check out our new web site Next Meeting
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
Inheritance and Polymorphism Recitation 04/10/2009 CS 180 Department of Computer Science, Purdue University.
C#: Project Cool Arthur Ketchel II Keith Francisco Chris McInnis.
Lecture 9 Concepts of Programming Languages
Abstract Data Types and Encapsulation Concepts
(c) University of Washington03-1 CSC 143 Java Inheritance Reading: Ch. 10.
OOP Languages: Java vs C++
Major Sponsors Minor Sponsors. about John Liu Contents What is TypeScript Why do we need TypeScript How Demo Pinteresp Working with your existing JavaScript.
Philly.NET Hands-on Labs JAVASCRIPT SERIES. July 9: JavaScript Syntax Visual Studio ◦Projects ◦Editors ◦Debugging ◦Script blocks ◦Minification and bundling.
C++ Code Analysis: an Open Architecture for the Verification of Coding Rules Paolo Tonella ITC-irst, Centro per la Ricerca Scientifica e Tecnologica
Static and Dynamic Behavior CMPS Power of OOP Derives from the ability of objects to change their behavior dynamically at run time. Static – refers.
Major Sponsors Minor Sponsors. about John Liu Contents What is TypeScript Why do we need TypeScript How Demo Pinteresp Working with your existing JavaScript.
Distributed Systems (236351) Tutorial 1 - Getting Started with Visual Studio C#.NET.
11 июля 2015 As true as steel to your desire You come with just an idea - we make great software for you! Trust Teamwork Transparency TypeScript – обзор.
Programming Languages and Paradigms Object-Oriented Programming (Part II)
Programming Language C++ Xulong Peng CSC415 Programming Languages.
Ontology Engineering and Plugin Development with the NeOn Toolkit Plug-in Development for the NeOn Toolkit June 1st, 2008 Michael Erdmann, Peter Haase,
CMSC 202 Generics. Nov Generalized Code One goal of OOP is to provide the ability to write reusable, generalized code. Polymorphic code using.
Method Overriding Remember inheritance: when a child class inherits methods, variables, etc from a parent class. Example: public class Dictionary extends.
Inheritance, Abstract & Interface Pepper With help from and
Introduction to TypeScript Sergey Barskiy Architect Level: Introductory.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
Copyright © Curt Hill Generic Classes Template Classes or Container Classes.
Version 5. ¿What is PAF? PAF is a tool to easily and quickly implement… …distributed analysis over ROOT trees. …by hiding as much as possible the inherent.
JDojo and Its Usage Te-Hsin Shih 04/30/2013. Dojo Dojo Toolkit is an open source JavaScript library designed to ease the rapid development of cross-platform,
Chapter 5 Objects and Classes Inheritance. Solution Assignments 3 & 4 Review in class…..
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
3C-1 Purity Typing Language semantics Inheritance model  Single vs. Multiple inheritance  Common root Modular mechanisms Generics Object Oriented Languages.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Method Overriding Remember inheritance: when a child class inherits methods, variables, etc from a parent class. Example: public class Dictionary extends.
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
Support standard JavaScript code with static typing Encapsulation through classes and modules Support for constructors, properties and.
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
John Liu. Senior Consultant for SharePoint Gurus Sydney User Groups, SharePoint Saturday, SharePoint Conferences,
SourceAnatomy1 Java Source Anatomy Barb Ericson Georgia Institute of Technology July 2008.
Generic Programming and Library Design Brian Bartman
NativeScript – Open source platform to build Native iOS/Android Apps.
Mail Web Twitter TypeScript Rainer Stropek software architects gmbh JavaScript on Steroids.
TypeScript: The Gateway Drug Whittaker.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
ANGULAR 2. JavaScript is a high-level, dynamic, untyped, and interpreted programming language. JavaScript was originally developed in May 1995 by Brendan.
Introduction to TypeScript
Angular 4 + TypeScript Getting Started
Abstract Data Types and Encapsulation Concepts
Objects as a programming concept
Introduction to TypeScript & Angular
9/13/2018 7:43 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
12 Data abstraction Packages and encapsulation
Angularjs Interview Questions and Answers By Hope Tutors.
CS240: Advanced Programming Concepts
More on Classes & Arrays
Typescript Programming Languages
Microsoft Build /22/2018 6:07 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
Inherited Classes in Java
JavaScript Reserved Words
TypeScript and Angular 2
CS5220 Advanced Topics in Web Programming Node.js Basics
CS3220 Web and Internet Programming JavaScript Basics
CS5220 Advanced Topics in Web Programming Angular – TypeScript
What is TypeScript, and Should You Care?
Build 2014 Anders Hejlsberg Technical Fellow
CS5220 Advanced Topics in Web Programming Angular – TypeScript
Introduction to TypeScript
Presentation transcript:

TypeScript : All parts are good Andriy Deren CEO, Onlizer

TypeScript: Who, when and why?

iforum.ua | 2016 JavaScript | Wide-spread development platform Low entry threshold Flexible and extensible language Huge community and ecosystem Only one language working native in-browser Working practically everywhere now

iforum.ua | 2016 JavaScript | Development challenges Complicated inheritance and visibility paradigm Dynamically typed: cure and curse Transparent architecture design is hard to implement Well-known design problems: global variables, spaghetti code, dependencies hell, callbacks hell, lines scripts and many more Huge, enterprise-oriented and full-JS projects are hard to implement and painful to support

iforum.ua | 2016 TypeScript | Historical retrospective TypeScript was first made public in October 2012 Anders Hejlsberg, lead architect of C# and creator of Delphi and Turbo Pascal, has worked on the development of TypeScript Originated from the perceived shortcomings of JavaScript for the development of large-scale applications As TypeScript is a superset of JavaScript, any existing JavaScript programs are also valid TypeScript programs. Open-source + community support = fast growth

iforum.ua | 2016 TypeScript | One year – four releases

Language features

iforum.ua | 2016 TypeScript | General features Strong typing system + type annotations = static and compile time checking Class-based inheritance system Type inference Visibility flags (public/private) Interfaces, enums, tuples, unions Optional properties, optional parameters, default parameters

iforum.ua | 2016 TypeScript | Advanced features Generics Iterators (for.. of, for.. in) and Generators Strings templating Decorators Build-in modular system Supports build-in JS functions Everything can be typed (thanks to *.d.ts) Supports modern ES features now

iforum.ua | 2016 TypeScript | Little sample class Animal { constructor() { this.health = 100; this.name = "No name"; } health: number; name: string; checkAlive(): boolean { return this.health > 0; } takeDamage(capacity: number): void { this.health -= capacity; } interface ILazy { sleep(): void; } class Cat extends Animal implements ILazy { private lifesCount: number; constructor() { super(); //calls super-class constructor this.lifesCount = 9; } takeDamage(capacity: number): void { super.takeDamage(capacity); if (this.health <= 0) this.lifesCount -= 1; } checkAlive(): boolean { return this.lifesCount > 0; } sleep(): void { if (this.health < 100) this.health++; }

iforum.ua | 2016 TypeScript | Iterators An object is deemed iterable if it has an implementation for the Symbol.iterator property. Build-in: Array, Map, Set, String, Int32Array, Uint32Array let list = [4, 5, 6]; for (let i in list) { console.log(i); // "0", "1", "2", } for (let i of list) { console.log(i); // "4", "5", "6" } let pets = new Set(["Cat", "Dog", "Hamster"]); pets["species"] = "mammals"; for (let pet in pets) { console.log(pet); // "species" } for (let pet of pets) { console.log(pet); // "Cat", "Dog", "Hamster" }

iforum.ua | 2016 TypeScript | Union types and type-guards Sometimes our function can return result from specter of types but we prefer don’t use build-in type any for many reasons. There we can use union types: function getSmallPet(): Bird | Fish { //creator logic here } But usage can be painful: let pet = this.getSmallPet(); if (( pet).swim) { ( pet).swim(); } else { ( pet).fly(); }

iforum.ua | 2016 TypeScript | Union types and type-guards So we need reduce noise of types conversion and add type guard: function isFish(pet: Fish | Bird): pet is Fish { //user defined type-guard return ( pet).swim !== undefined; } if (isFish(pet)) { //no type-conversion needed pet.swim(); } else { pet.fly(); } function isNumber(x: any): x is number { //typeof x usage return typeof x === "number"; } if (pet instanceof Fish) { //instanceof x usage pet.swim(); }

iforum.ua | 2016 TypeScript | Module system General understanding: module is namespace export const numberRegexp = /^[0-9]+$/; //inline export class ZipCodeValidator implements StringValidator { isAcceptable(s: string) { return s.length === 5 && numberRegexp.test(s); } export { ZipCodeValidator }; //single export export { ZipCodeValidator as mainValidator }; //export with renaming Import examples import { ZipCodeValidator } from "./ZipCodeValidator"; //single import let myValidator = new ZipCodeValidator(); import * as validator from "./ZipCodeValidator"; //module import let myValidator = new validator.ZipCodeValidator();

iforum.ua | 2016 TypeScript | Decorators A Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter. Decorator expression must evaluate to a function that will be called at runtime with information about the decorated class ClassToSeal{ //some implementation } function sealed(constructor: Function) { Object.seal(constructor); Object.seal(constructor.prototype); }

Development ecosystem

iforum.ua | 2016 Development | Tools

iforum.ua | 2016 Development | Community GitHub 3,800+ commits in the last year 1,200+ forks 10,000+ stars Stack Overflow 8,000+ questions, up more than 2x in the last year Stack Overflow 1,600+.d.ts declaration files, up 2x in the last year

iforum.ua | 2016 Development | Adoption

Development | Frameworks

Real-life experience

iforum.ua | 2016 TypeScript | Best for… Developers Junior Web-developers to simplify learning and create better code Experienced JS-developers – for productivity, fun and profit As second language or migration for C#, Java, C++, Objective-C developers

iforum.ua | 2016 TypeScript | Best for… Projects Any large ES-based project Full-JS stack Web solutions (Node.js + Angular, React, Durandal, Aurelia, etc.) Mixed-stack solutions for teams with experience in C#, Java, C++ Mobile solutions IoT solutions

iforum.ua | 2016 TypeScript | Where to start TypeScript official site TypeScript Jump Start /TypeScript-Jump-Start1 What's New in TypeScript? Typescript with Angular /TypeScript--Angular/TypeScript--Angular

Many thanks for attention!