SlideShare ist ein Scribd-Unternehmen logo
1 von 26
TYPESCRIPT
JS CODING JUST GOT BETTER!
ABOUT ME
Amit Bezalel
• UFT & SRF System Architect
• Wrote: C++, Java, C#, JavaScript, now Typescript
• Recently read up on a ton of cloud architecture
• Some articles on codeproject and HP Blog
Amit.Bezalel@hpe.com
JAVASCRIPT
On May 1995 a Netscape dev created a new programming language
It took him 10 days
It was called Mocha internally
Then LiveScript
And eventually JavaScript
20 years later it’s the hottest language on the planet !
JAVASCRIPT IS HERE TO STAY
Good things in JS:
• The language of the browser
• Widely used for Micro-Services
• A Large community
• A full stack language (Server + UI)
• Very flexible
• Asynchronous
Stack
overflow
2016
JAVASCRIPT IS HERE TO STAY
Some bad things:
• No block scope
• Over-flexible function definitions
• No interfaces
• Typing confusions
• Performance pitfalls
• The ‘this’ variable
• Semicolon auto completion
TS IMPROVES JS
TS Solutions:
• [√] No block scope
• [√] Over-flexible function definitions
• [√] No interfaces
• [√] Typing confusions
• [√] Performance pitfalls
• [√] The ‘this’ variable
• [x] Semicolon auto completion
WHY NOT TYPESCRIPT?
Common complaints I heard:
• Adds a compilation step
• you will have a build process anyway
• Relies on Microsoft
• MS proved itself with C#
• Doesn’t prevent JS pitfalls
• Many of them are prevented (as we saw)
• The price of keeping JS flexibility
• The illusion of safety, but still JS
• IMHO it is actually more safe given that you use types
• OO constructs may be abused
• This also goes for Java / C#
IT’S TRENDY
• TS surpasses all other
JS pre-compilers
• TS also passed SASS
which is widely used.
• Fast growing trend line,
indicating exponential
growth in 2016
WHO USES TS
SOME QUOTES
There are Many blogs about TS, here are some quotes:
• Angular 2.0: “typescript makes code easier to read and
understand”
• Telerik: “TypeScript may be the best of the many JavaScript front
ends”
(even though he didn’t want to use it at the end)
• Wix: “TypeScript generates JavaScript code that is easy to read
and debug”
• Asana: “static typing allows us to skip checks that would
otherwise be required at runtime”
• Microsoft:
• VS Code – An IDE Written in Typescript for Typescript
• The TS compiler itself is also written in TS (wikipedia)
WHAT IS ADDED TO JS?
• Features:
• An optional type system
• ES6, ES7 features
• Adds missing OO features
• Compilation
• Compile to any ES flavor (ES3 / ES5 / ES6)
• Fast compilation
• IDE Support:
• Good Code completion (Intellisence)
• Wide adoption in modern IDEs
• Better navigation and readability (jump to def, refactoring)
THE TS PROJECT
• Opensource (github)
• Apache 2.0 license
• https://github.com/Microsoft/TypeScript
• TS is Written in TS:
• https://github.com/Microsoft/TypeScript/tree/master/src/compiler
• Live community (bugs / suggesstions / pull requests)
• https://visualstudio.uservoice.com/forums/293070-visual-studio-code
LANGUAGE FEATURES
• Basic Types
• Classes (Inheritance, private members)
• Interfaces
• Generics
• Enums
• Mixins
• Let
• Async await
• Arrow functions (obj) => {}
• Modules
• Parameter default values
ES5 / ES3 GENERATION
ES6 GENERATION
TYPESCRIPT IDE SUPPORT
TS Code
completio
n
TS
Debugger
IDE
Performan
ce
Cross
platfor
m
Maturity Release &
activity
Needs
proj /
sln files
VS Code Excellent Good Excellent Yes v1.0 Monthly no
IntelliJ
14+
Webstor
m
Ok Good Ok (high
RAM)
Yes Mature Every
Several
months
no
Visual
studio
2013+
Good Good Bad (For
large TS
projects)
No Mature 3 months yes
Eclipse
TypEcs
Ok Ok Ok Yes v1.0 no recent
activity, 6
months
no
WHAT IS VSCODE?
• A new fully featured IDE from Microsoft
• Very lightweight
• MIT licensed opensource in GitHub
• Cross platform (mac/ linux /windows)
• Written over electron (V8 desktop platform)
• Everything is code (including project settings)
• Released v1.0 five days ago!
• A new release each month
• Huge amount of features in each release
• 500,000 users and counting
Releases blog:
https://code.visualstudio.com/blogs
COMMONJS & TYPINGS
• Importing npm modules
• Using import / var with require
• Getting type information for npms
• d.ts files
• Definitely typed git repo (ambient)
• Old reference comments (tsd) vs. new (typings) method
• Keeping types across files / modules
• Auto generated typing files (d.ts)
• Installing types from original repo
• The typings install commandline
OUR STORY
• Started out with Pure NodeJS 2~4
• Added some more people ~6
• JS Code is hard to understand…
• Moved to TS
• Now we are ~18 and growing!
• Using typescript in UI side as well as backend
• 20+ micro services in our architecture
• Using both intelliJ 15 & VSCode (dev’s choice)
OUR CONCLUSIONS
Our Cons:
- Smallish learning curve
- Mixing JS / TS possible, problematic inheritance
Our Pros:
+ Readability and code navigation increased
+ Refactoring & Code completion
+ Types are important
+ Classes and interfaces give structure
+ TS Scales, new team members benefit
MICRO SERVICES
• Decoupled, services
• Single responsibility
• Independent technology stacks
• Communication via Rest / WS APIs
• Swagger definitions
Typescript benefits:
• Swagger definitions can be generated from classes (including
types)
• Function signature checking adds interface enforcement
TS WITH NODEJS
Benefits:
• Rest body definitions can be generated from object definitions
• Code completion helps keep the correct structures
• Types are enforced for incoming data
Stack
overflow
2016
WEB UI & TYPESCRIPT
• Angular 2.0 is written in TypeScript
• You get up to date definitions
• Angular tools are ready for TS usage
• Typescript debugging in browser (via mapping & IDE extension)
• A short learning curve (close to JS)
WHAT’S NEXT
The future of typescript (v2.0):
• ReadOnly & abstract Properties
• Async / await support for ES5/ES3 generation
• Private/protected constructors
• Type definition for “this”
• Runtime Type checking for properties
• Much more…
Links:
• https://github.com/Microsoft/TypeScript/wiki/Roadmap

Weitere ähnliche Inhalte

Was ist angesagt?

QA Fest 2016. Роман Горин. Введение в системы распознавания речи глазами тест...
QA Fest 2016. Роман Горин. Введение в системы распознавания речи глазами тест...QA Fest 2016. Роман Горин. Введение в системы распознавания речи глазами тест...
QA Fest 2016. Роман Горин. Введение в системы распознавания речи глазами тест...
QAFest
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
Patrick John PacaĂąa
 

Was ist angesagt? (20)

Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScript
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
 
QA Fest 2016. Роман Горин. Введение в системы распознавания речи глазами тест...
QA Fest 2016. Роман Горин. Введение в системы распознавания речи глазами тест...QA Fest 2016. Роман Горин. Введение в системы распознавания речи глазами тест...
QA Fest 2016. Роман Горин. Введение в системы распознавания речи глазами тест...
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!
 
Typescript ppt
Typescript pptTypescript ppt
Typescript ppt
 
Introducing type script
Introducing type scriptIntroducing type script
Introducing type script
 
TypeScript intro
TypeScript introTypeScript intro
TypeScript intro
 
Angular2.0@Shanghai0319
Angular2.0@Shanghai0319Angular2.0@Shanghai0319
Angular2.0@Shanghai0319
 
From .NET Core 3, all the rest will be legacy
From .NET Core 3, all the rest will be legacyFrom .NET Core 3, all the rest will be legacy
From .NET Core 3, all the rest will be legacy
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
 
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript Fundamentals
 
Pi j1.1 what-is-java
Pi j1.1 what-is-javaPi j1.1 what-is-java
Pi j1.1 what-is-java
 
Typescript - MentorMate Academy
Typescript - MentorMate AcademyTypescript - MentorMate Academy
Typescript - MentorMate Academy
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
 
Getting Started with TypeScript
Getting Started with TypeScriptGetting Started with TypeScript
Getting Started with TypeScript
 
Java script fundamental - Introduction to JavaScript Programming Language
Java script fundamental - Introduction to JavaScript Programming LanguageJava script fundamental - Introduction to JavaScript Programming Language
Java script fundamental - Introduction to JavaScript Programming Language
 
JS Fest 2018. Александр Скачков. WebAssembly vs JavaScript
JS Fest 2018. Александр Скачков. WebAssembly vs JavaScriptJS Fest 2018. Александр Скачков. WebAssembly vs JavaScript
JS Fest 2018. Александр Скачков. WebAssembly vs JavaScript
 
Typescript 101 introduction
Typescript 101   introductionTypescript 101   introduction
Typescript 101 introduction
 
TypeScript
TypeScriptTypeScript
TypeScript
 

Andere mochten auch

Double page spread stages powerpoint
Double page spread stages powerpointDouble page spread stages powerpoint
Double page spread stages powerpoint
kittylantos
 
Những bệnh cần khám ở phụ nữ trên 70
Những bệnh cần khám ở phụ nữ trên 70Những bệnh cần khám ở phụ nữ trên 70
Những bệnh cần khám ở phụ nữ trên 70
vicente464
 
cir vita Dec2015
cir vita Dec2015cir vita Dec2015
cir vita Dec2015
Mohamed Ezzat
 
Rich Goidel Infographic
Rich Goidel InfographicRich Goidel Infographic
Rich Goidel Infographic
Rich Goidel
 
CV - VAC-JUL 2015
CV - VAC-JUL 2015CV - VAC-JUL 2015
CV - VAC-JUL 2015
Vithal Chavan
 
MY AFRICAN DREAM OF CREATING HAPPIER HEALTHIER MORE EFFICIENT & EFFECTIVE CIT...
MY AFRICAN DREAM OF CREATING HAPPIER HEALTHIER MORE EFFICIENT & EFFECTIVE CIT...MY AFRICAN DREAM OF CREATING HAPPIER HEALTHIER MORE EFFICIENT & EFFECTIVE CIT...
MY AFRICAN DREAM OF CREATING HAPPIER HEALTHIER MORE EFFICIENT & EFFECTIVE CIT...
Scholastica Sylvan Kimaryo
 
MI SIRB SQ K.JHA OSA.
MI SIRB SQ K.JHA OSA.MI SIRB SQ K.JHA OSA.
MI SIRB SQ K.JHA OSA.
KAMAKHYA JHA
 
Ervarings compleet C V 03-5-2015
Ervarings compleet C V  03-5-2015Ervarings compleet C V  03-5-2015
Ervarings compleet C V 03-5-2015
Marcel Broek, van den
 
Vat and international trade ukti internal nov14
Vat and international trade ukti internal nov14Vat and international trade ukti internal nov14
Vat and international trade ukti internal nov14
taxadvicedirect
 

Andere mochten auch (20)

Typescript for the programmers who like javascript
Typescript for the programmers who like javascriptTypescript for the programmers who like javascript
Typescript for the programmers who like javascript
 
TypeScript DevSum 2013
TypeScript DevSum 2013TypeScript DevSum 2013
TypeScript DevSum 2013
 
Typescript: enjoying large scale browser development
Typescript: enjoying large scale browser developmentTypescript: enjoying large scale browser development
Typescript: enjoying large scale browser development
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Double page spread stages powerpoint
Double page spread stages powerpointDouble page spread stages powerpoint
Double page spread stages powerpoint
 
Những bệnh cần khám ở phụ nữ trên 70
Những bệnh cần khám ở phụ nữ trên 70Những bệnh cần khám ở phụ nữ trên 70
Những bệnh cần khám ở phụ nữ trên 70
 
Pernicious Influence - Marked As Disciples series
Pernicious Influence - Marked As Disciples seriesPernicious Influence - Marked As Disciples series
Pernicious Influence - Marked As Disciples series
 
cir vita Dec2015
cir vita Dec2015cir vita Dec2015
cir vita Dec2015
 
Watch For Jesus' Return - STAY AWAKE!
Watch For Jesus' Return - STAY AWAKE!Watch For Jesus' Return - STAY AWAKE!
Watch For Jesus' Return - STAY AWAKE!
 
The Amazing Gospel!
The Amazing Gospel!The Amazing Gospel!
The Amazing Gospel!
 
Rich Goidel Infographic
Rich Goidel InfographicRich Goidel Infographic
Rich Goidel Infographic
 
CV - VAC-JUL 2015
CV - VAC-JUL 2015CV - VAC-JUL 2015
CV - VAC-JUL 2015
 
Erfa- kursusbevis
Erfa- kursusbevisErfa- kursusbevis
Erfa- kursusbevis
 
MY AFRICAN DREAM OF CREATING HAPPIER HEALTHIER MORE EFFICIENT & EFFECTIVE CIT...
MY AFRICAN DREAM OF CREATING HAPPIER HEALTHIER MORE EFFICIENT & EFFECTIVE CIT...MY AFRICAN DREAM OF CREATING HAPPIER HEALTHIER MORE EFFICIENT & EFFECTIVE CIT...
MY AFRICAN DREAM OF CREATING HAPPIER HEALTHIER MORE EFFICIENT & EFFECTIVE CIT...
 
Carbon Fee and Dividend ICC Rotary
Carbon Fee and Dividend ICC RotaryCarbon Fee and Dividend ICC Rotary
Carbon Fee and Dividend ICC Rotary
 
MI SIRB SQ K.JHA OSA.
MI SIRB SQ K.JHA OSA.MI SIRB SQ K.JHA OSA.
MI SIRB SQ K.JHA OSA.
 
RelazioneENG
RelazioneENGRelazioneENG
RelazioneENG
 
Don't Assume You're Creating Value - Prove it!
Don't Assume You're Creating Value - Prove it!Don't Assume You're Creating Value - Prove it!
Don't Assume You're Creating Value - Prove it!
 
Ervarings compleet C V 03-5-2015
Ervarings compleet C V  03-5-2015Ervarings compleet C V  03-5-2015
Ervarings compleet C V 03-5-2015
 
Vat and international trade ukti internal nov14
Vat and international trade ukti internal nov14Vat and international trade ukti internal nov14
Vat and international trade ukti internal nov14
 

Ähnlich wie Typescript: JS code just got better!

NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
Dmytro Mindra
 

Ähnlich wie Typescript: JS code just got better! (20)

TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San JoseTypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
 
Using type script to build better apps
Using type script to build better appsUsing type script to build better apps
Using type script to build better apps
 
Getting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGetting Started with the TypeScript Language
Getting Started with the TypeScript Language
 
Node ts1
Node ts1Node ts1
Node ts1
 
The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript
 
AngularConf2015
AngularConf2015AngularConf2015
AngularConf2015
 
Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type script
 
An Introduction to ReactNative
An Introduction to ReactNativeAn Introduction to ReactNative
An Introduction to ReactNative
 
One language to rule them all type script
One language to rule them all type scriptOne language to rule them all type script
One language to rule them all type script
 
2020 oct zowe quarterly webinar series
2020 oct zowe quarterly webinar series2020 oct zowe quarterly webinar series
2020 oct zowe quarterly webinar series
 
Introduction_to_NET.ppt
Introduction_to_NET.pptIntroduction_to_NET.ppt
Introduction_to_NET.ppt
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
 
TypeScript and Angular2 (Love at first sight)
TypeScript and Angular2 (Love at first sight)TypeScript and Angular2 (Love at first sight)
TypeScript and Angular2 (Love at first sight)
 
TypeScript - Javascript done right
TypeScript - Javascript done rightTypeScript - Javascript done right
TypeScript - Javascript done right
 
APIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidadAPIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidad
 
SGCE 2015 REST APIs
SGCE 2015 REST APIsSGCE 2015 REST APIs
SGCE 2015 REST APIs
 
Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
 
Vincent biret azure functions and flow (ottawa)
Vincent biret azure functions and flow (ottawa)Vincent biret azure functions and flow (ottawa)
Vincent biret azure functions and flow (ottawa)
 

KĂźrzlich hochgeladen

Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

KĂźrzlich hochgeladen (20)

%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

Typescript: JS code just got better!

  • 2. ABOUT ME Amit Bezalel • UFT & SRF System Architect • Wrote: C++, Java, C#, JavaScript, now Typescript • Recently read up on a ton of cloud architecture • Some articles on codeproject and HP Blog Amit.Bezalel@hpe.com
  • 3. JAVASCRIPT On May 1995 a Netscape dev created a new programming language It took him 10 days It was called Mocha internally Then LiveScript And eventually JavaScript 20 years later it’s the hottest language on the planet !
  • 4. JAVASCRIPT IS HERE TO STAY Good things in JS: • The language of the browser • Widely used for Micro-Services • A Large community • A full stack language (Server + UI) • Very flexible • Asynchronous Stack overflow 2016
  • 5. JAVASCRIPT IS HERE TO STAY Some bad things: • No block scope • Over-flexible function definitions • No interfaces • Typing confusions • Performance pitfalls • The ‘this’ variable • Semicolon auto completion
  • 6. TS IMPROVES JS TS Solutions: • [√] No block scope • [√] Over-flexible function definitions • [√] No interfaces • [√] Typing confusions • [√] Performance pitfalls • [√] The ‘this’ variable • [x] Semicolon auto completion
  • 7. WHY NOT TYPESCRIPT? Common complaints I heard: • Adds a compilation step • you will have a build process anyway • Relies on Microsoft • MS proved itself with C# • Doesn’t prevent JS pitfalls • Many of them are prevented (as we saw) • The price of keeping JS flexibility • The illusion of safety, but still JS • IMHO it is actually more safe given that you use types • OO constructs may be abused • This also goes for Java / C#
  • 8. IT’S TRENDY • TS surpasses all other JS pre-compilers • TS also passed SASS which is widely used. • Fast growing trend line, indicating exponential growth in 2016
  • 10. SOME QUOTES There are Many blogs about TS, here are some quotes: • Angular 2.0: “typescript makes code easier to read and understand” • Telerik: “TypeScript may be the best of the many JavaScript front ends” (even though he didn’t want to use it at the end) • Wix: “TypeScript generates JavaScript code that is easy to read and debug” • Asana: “static typing allows us to skip checks that would otherwise be required at runtime” • Microsoft: • VS Code – An IDE Written in Typescript for Typescript • The TS compiler itself is also written in TS (wikipedia)
  • 11.
  • 12. WHAT IS ADDED TO JS? • Features: • An optional type system • ES6, ES7 features • Adds missing OO features • Compilation • Compile to any ES flavor (ES3 / ES5 / ES6) • Fast compilation • IDE Support: • Good Code completion (Intellisence) • Wide adoption in modern IDEs • Better navigation and readability (jump to def, refactoring)
  • 13. THE TS PROJECT • Opensource (github) • Apache 2.0 license • https://github.com/Microsoft/TypeScript • TS is Written in TS: • https://github.com/Microsoft/TypeScript/tree/master/src/compiler • Live community (bugs / suggesstions / pull requests) • https://visualstudio.uservoice.com/forums/293070-visual-studio-code
  • 14. LANGUAGE FEATURES • Basic Types • Classes (Inheritance, private members) • Interfaces • Generics • Enums • Mixins • Let • Async await • Arrow functions (obj) => {} • Modules • Parameter default values
  • 15. ES5 / ES3 GENERATION
  • 17. TYPESCRIPT IDE SUPPORT TS Code completio n TS Debugger IDE Performan ce Cross platfor m Maturity Release & activity Needs proj / sln files VS Code Excellent Good Excellent Yes v1.0 Monthly no IntelliJ 14+ Webstor m Ok Good Ok (high RAM) Yes Mature Every Several months no Visual studio 2013+ Good Good Bad (For large TS projects) No Mature 3 months yes Eclipse TypEcs Ok Ok Ok Yes v1.0 no recent activity, 6 months no
  • 18. WHAT IS VSCODE? • A new fully featured IDE from Microsoft • Very lightweight • MIT licensed opensource in GitHub • Cross platform (mac/ linux /windows) • Written over electron (V8 desktop platform) • Everything is code (including project settings) • Released v1.0 five days ago! • A new release each month • Huge amount of features in each release • 500,000 users and counting Releases blog: https://code.visualstudio.com/blogs
  • 19. COMMONJS & TYPINGS • Importing npm modules • Using import / var with require • Getting type information for npms • d.ts files • Definitely typed git repo (ambient) • Old reference comments (tsd) vs. new (typings) method • Keeping types across files / modules • Auto generated typing files (d.ts) • Installing types from original repo • The typings install commandline
  • 20.
  • 21. OUR STORY • Started out with Pure NodeJS 2~4 • Added some more people ~6 • JS Code is hard to understand… • Moved to TS • Now we are ~18 and growing! • Using typescript in UI side as well as backend • 20+ micro services in our architecture • Using both intelliJ 15 & VSCode (dev’s choice)
  • 22. OUR CONCLUSIONS Our Cons: - Smallish learning curve - Mixing JS / TS possible, problematic inheritance Our Pros: + Readability and code navigation increased + Refactoring & Code completion + Types are important + Classes and interfaces give structure + TS Scales, new team members benefit
  • 23. MICRO SERVICES • Decoupled, services • Single responsibility • Independent technology stacks • Communication via Rest / WS APIs • Swagger definitions Typescript benefits: • Swagger definitions can be generated from classes (including types) • Function signature checking adds interface enforcement
  • 24. TS WITH NODEJS Benefits: • Rest body definitions can be generated from object definitions • Code completion helps keep the correct structures • Types are enforced for incoming data Stack overflow 2016
  • 25. WEB UI & TYPESCRIPT • Angular 2.0 is written in TypeScript • You get up to date definitions • Angular tools are ready for TS usage • Typescript debugging in browser (via mapping & IDE extension) • A short learning curve (close to JS)
  • 26. WHAT’S NEXT The future of typescript (v2.0): • ReadOnly & abstract Properties • Async / await support for ES5/ES3 generation • Private/protected constructors • Type definition for “this” • Runtime Type checking for properties • Much more… Links: • https://github.com/Microsoft/TypeScript/wiki/Roadmap

Hinweis der Redaktion

  1. Command line compilation (tsc) Intellisence demo (Vscode completion) Typings system + Ambient for JS projects Code intellisence JS interoperability, and optionality of types Debugging in TS IDE parsing & Compilation Errors Debugging the *.ts files via mapping