SlideShare ist ein Scribd-Unternehmen logo
1 von 17
活字体カタ:テスト駆動開発

TypeScript Kata
The TDD style 2 edition
Ronnie Hegelund
Creator of AutoFixtureTS
http://bit.ly/XYF0Gp
Author of Enterprise development in TypeScript
http://bit.ly/11WyKF8

@ronniedrengen

http://ronniehegelund.blogspot.dk/
About me!
Ronnie Hegelund
Technical Lead, Widex A/S
http://ronniehegelund.blogspot.dk/
@ronniedrengen
Love all facets of software development from
Test driven development, Software Architecture, continuous delivery
Focus on
Web, C#, TypeScript and Developer/Team productivity

Latest projects
• TypeScript BCL
• TypeScript weekly
• CommunitySnippets for VisualStudio
• Writing a book. Enterprise development In TypeScript
• Visual Studio Test project templates
Agenda
1.
2.
3.
4.

What is TypeScript
Test Driven Development
Concepts of Code kata’s
Doing string calculator kata with
TypeScript
Visual Studio
Jasmine
What is TypeScript

TypeScript is a language for application scale
JavaScript development.
What is TypeScript

TypeScript is a typed superset of JavaScript
that compiles to plain JavaScript.
Any browser. Any host. Any OS.

Open Source.
What is TypeScript
TypeScript?
TypeScript is JavaScript with high-level language features.
Keyword

Description

Modules

Encapsulation for code and classes

Imports

Import modules

Exports

Export a member from module

Class

Encapsulation for properties, variables and function members

Extends

Extend a class. Used for inheritance

Implements

Implements an interface

Interface

Defines a contract of behavior when implemented by types

Constructor

Provide initialization for classes

Public and Private

Member visibillity modifier

=>

Arrow syntax, also called lambda expressions, used with definitions and functions

:

Seperator between the variable name and the variable type

...

Rest syntax, the same as the C#’s method parameter params

<TypeName>

Casting a type to another types

Generics <T>

Encapsulate operations that are not specific to a particular type

Enum

Used to quickly declare a range of constant or computed values
What is TypeScript
Starts with JavaScript
All JavaScript code is TypeScript code, simply copy and paste
All JavaScript libraries work with TypeScript

Optional Static Types, Classes, Modules
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
What is TypeScript
Library Typings (.d.ts files)
DefinitelyTyped has > 326 community library typings projects
344 contributors

Tools and Build Integration
Rich IDEs: Visual Studio, Eclipse, WebStorm, Cloud9, Brackets
Text Editors: SublimeText, vi, Emacs, JSBin
Build Integration: ASP.NET, node.js, compile-in-client, Ruby, grunt
and more

Open Source
Active development on CodePlex
Thousands of issues/discussions, hundreds of participants
Who’s already using TypeScript
Test-Driven Development
We all know that we need to test our code, but do we do it?
9 out of 10 times we skip it over because we just think it's faster.
My conclusion is that I am about 10% faster, and my code tested!

TDD In the simplest form
Solution, Testing vs TDD
Testing

Test-Driven Development

Design

Design

Test

Implement
Implement

Test
Test
How to do it
Design: figure out what you want
Test: write a test to express the design
It should FAIL
Implement: Write the code
Test againg:
It should PASS
Code Kata

Using Code Kata’s to become a better developer
Code kata is an exercise in programming that helps a programmer hone
their skills through practice and repetition.

A kata a day keeps the debugger away
Apply a Kata daily for at least 15 minutes, by coding, refactoring and test-first,.

Before you begin a Kata:
Try not to read ahead.
Do one task at a time. The trick is to learn to work incrementally.
Make sure you only test for correct inputs. there is no need to test for invalid
inputs for this kata
Code Katas aren’t effective

Doing the same thing over and over again doesn’t make us better at it

When we first learned from walking it was tuff, now it’s just a repetitive process
Lets do a string

kata with
Diverse links
• TypeScript http://www.typescriptlang.org/
• Kata practices bit.ly/3sUjzK
• StringCalculator in different languages bit.ly/2wma3X
• Chutzpah – Javascript test runner bit.ly/qsazVS
• DefinitelyTyped repositories
• Github bit.ly/Shdyzn
• Nuget.org http://bit.ly/W0V3bD
• nodeJS TSDPM bit.ly/VMo1LQ
• TypeScript Weekly http://paper.li/ronniedrengen/1386937876

Weitere ähnliche Inhalte

Was ist angesagt?

Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief example
Jeremy Kendall
 
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
VincitOy
 

Was ist angesagt? (20)

Golang
GolangGolang
Golang
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
 
Kshitij
KshitijKshitij
Kshitij
 
Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief example
 
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
 
Introduction to Spock: A Unit Testing Framework
Introduction to Spock: A Unit Testing FrameworkIntroduction to Spock: A Unit Testing Framework
Introduction to Spock: A Unit Testing Framework
 
Test your user interface using BDD (Swedish)
Test your user interface using BDD (Swedish)Test your user interface using BDD (Swedish)
Test your user interface using BDD (Swedish)
 
Developer Job in Practice
Developer Job in PracticeDeveloper Job in Practice
Developer Job in Practice
 
How do we test nodejs apps?
How do we test nodejs apps?How do we test nodejs apps?
How do we test nodejs apps?
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspec
 
TypeScript
TypeScriptTypeScript
TypeScript
 
JDD2014: Continuous delivery: capitalizing high quality automated tests - Szc...
JDD2014: Continuous delivery: capitalizing high quality automated tests - Szc...JDD2014: Continuous delivery: capitalizing high quality automated tests - Szc...
JDD2014: Continuous delivery: capitalizing high quality automated tests - Szc...
 
Test Driven Development with PHP
Test Driven Development with PHPTest Driven Development with PHP
Test Driven Development with PHP
 
Go lang
Go langGo lang
Go lang
 
Working with c++ legacy code
Working with c++ legacy codeWorking with c++ legacy code
Working with c++ legacy code
 
TDD with RSpec
TDD with RSpecTDD with RSpec
TDD with RSpec
 
Effectively Reuse the Code Between PHP Projects
Effectively Reuse the Code Between PHP ProjectsEffectively Reuse the Code Between PHP Projects
Effectively Reuse the Code Between PHP Projects
 
Tdd
TddTdd
Tdd
 
Better Swift from the Foundation up #tryswiftnyc17 09-06
Better Swift from the Foundation up #tryswiftnyc17 09-06Better Swift from the Foundation up #tryswiftnyc17 09-06
Better Swift from the Foundation up #tryswiftnyc17 09-06
 
Tdd com Java
Tdd com JavaTdd com Java
Tdd com Java
 

Ähnlich wie Typescript kata The TDD style 2 edition

Agile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin NakovAgile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin Nakov
Svetlin Nakov
 
Launch .net updated
Launch .net updatedLaunch .net updated
Launch .net updated
aitrichtech
 

Ähnlich wie Typescript kata The TDD style 2 edition (20)

2024.04 - AI in Code Generation - April User Group Meeting
2024.04 - AI in Code Generation - April User Group Meeting2024.04 - AI in Code Generation - April User Group Meeting
2024.04 - AI in Code Generation - April User Group Meeting
 
Test driven development and react js application go hand in hand
Test driven development and react js application go hand in handTest driven development and react js application go hand in hand
Test driven development and react js application go hand in hand
 
TypeScript VS JavaScript.pptx
TypeScript VS JavaScript.pptxTypeScript VS JavaScript.pptx
TypeScript VS JavaScript.pptx
 
Six Steps to Conversation Driven Development
Six Steps to Conversation Driven DevelopmentSix Steps to Conversation Driven Development
Six Steps to Conversation Driven Development
 
Agile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin NakovAgile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin Nakov
 
Topic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolutionTopic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolution
 
Ten compelling reasons to learn .net framework
Ten compelling reasons to learn .net frameworkTen compelling reasons to learn .net framework
Ten compelling reasons to learn .net framework
 
Agile Methodologies And Extreme Programming
Agile Methodologies And Extreme ProgrammingAgile Methodologies And Extreme Programming
Agile Methodologies And Extreme Programming
 
Introduction to Agile Software Development & Python
Introduction to Agile Software Development & PythonIntroduction to Agile Software Development & Python
Introduction to Agile Software Development & Python
 
xUnit and TDD: Why and How in Enterprise Software, August 2012
xUnit and TDD: Why and How in Enterprise Software, August 2012xUnit and TDD: Why and How in Enterprise Software, August 2012
xUnit and TDD: Why and How in Enterprise Software, August 2012
 
How to Become a Front-End Developer? Step-by-Step Guide by Careervira
How to Become a Front-End Developer? Step-by-Step Guide by CareerviraHow to Become a Front-End Developer? Step-by-Step Guide by Careervira
How to Become a Front-End Developer? Step-by-Step Guide by Careervira
 
Agile & Test Driven Development: The Ampersand Commerce Approach
Agile & Test Driven Development: The Ampersand Commerce ApproachAgile & Test Driven Development: The Ampersand Commerce Approach
Agile & Test Driven Development: The Ampersand Commerce Approach
 
Samsung Indonesia: Tizen Native App
Samsung Indonesia: Tizen Native AppSamsung Indonesia: Tizen Native App
Samsung Indonesia: Tizen Native App
 
Launch .net updated
Launch .net updatedLaunch .net updated
Launch .net updated
 
Software Craftsmanship @ Ntnu
Software Craftsmanship @ NtnuSoftware Craftsmanship @ Ntnu
Software Craftsmanship @ Ntnu
 
Agile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous IntegrationAgile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous Integration
 
Agile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous IntegrationAgile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous Integration
 
Top Object-Oriented Programming Languages To Follow In December 2022.pdf
Top Object-Oriented Programming Languages To Follow In December 2022.pdfTop Object-Oriented Programming Languages To Follow In December 2022.pdf
Top Object-Oriented Programming Languages To Follow In December 2022.pdf
 
That worked before
That worked beforeThat worked before
That worked before
 
Best 5 Swift IDEs and Code Editors for Your Next iOS Project.pdf
Best 5 Swift IDEs and Code Editors for Your Next iOS Project.pdfBest 5 Swift IDEs and Code Editors for Your Next iOS Project.pdf
Best 5 Swift IDEs and Code Editors for Your Next iOS Project.pdf
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 

Typescript kata The TDD style 2 edition

  • 1. 活字体カタ:テスト駆動開発 TypeScript Kata The TDD style 2 edition Ronnie Hegelund Creator of AutoFixtureTS http://bit.ly/XYF0Gp Author of Enterprise development in TypeScript http://bit.ly/11WyKF8 @ronniedrengen http://ronniehegelund.blogspot.dk/
  • 2. About me! Ronnie Hegelund Technical Lead, Widex A/S http://ronniehegelund.blogspot.dk/ @ronniedrengen Love all facets of software development from Test driven development, Software Architecture, continuous delivery Focus on Web, C#, TypeScript and Developer/Team productivity Latest projects • TypeScript BCL • TypeScript weekly • CommunitySnippets for VisualStudio • Writing a book. Enterprise development In TypeScript • Visual Studio Test project templates
  • 3. Agenda 1. 2. 3. 4. What is TypeScript Test Driven Development Concepts of Code kata’s Doing string calculator kata with TypeScript Visual Studio Jasmine
  • 4. What is TypeScript TypeScript is a language for application scale JavaScript development.
  • 5. What is TypeScript TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open Source.
  • 7. TypeScript? TypeScript is JavaScript with high-level language features. Keyword Description Modules Encapsulation for code and classes Imports Import modules Exports Export a member from module Class Encapsulation for properties, variables and function members Extends Extend a class. Used for inheritance Implements Implements an interface Interface Defines a contract of behavior when implemented by types Constructor Provide initialization for classes Public and Private Member visibillity modifier => Arrow syntax, also called lambda expressions, used with definitions and functions : Seperator between the variable name and the variable type ... Rest syntax, the same as the C#’s method parameter params <TypeName> Casting a type to another types Generics <T> Encapsulate operations that are not specific to a particular type Enum Used to quickly declare a range of constant or computed values
  • 8. What is TypeScript Starts with JavaScript All JavaScript code is TypeScript code, simply copy and paste All JavaScript libraries work with TypeScript Optional Static Types, Classes, Modules 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
  • 9. What is TypeScript Library Typings (.d.ts files) DefinitelyTyped has > 326 community library typings projects 344 contributors Tools and Build Integration Rich IDEs: Visual Studio, Eclipse, WebStorm, Cloud9, Brackets Text Editors: SublimeText, vi, Emacs, JSBin Build Integration: ASP.NET, node.js, compile-in-client, Ruby, grunt and more Open Source Active development on CodePlex Thousands of issues/discussions, hundreds of participants
  • 10. Who’s already using TypeScript
  • 11. Test-Driven Development We all know that we need to test our code, but do we do it? 9 out of 10 times we skip it over because we just think it's faster. My conclusion is that I am about 10% faster, and my code tested! TDD In the simplest form
  • 12. Solution, Testing vs TDD Testing Test-Driven Development Design Design Test Implement Implement Test Test
  • 13. How to do it Design: figure out what you want Test: write a test to express the design It should FAIL Implement: Write the code Test againg: It should PASS
  • 14. Code Kata Using Code Kata’s to become a better developer Code kata is an exercise in programming that helps a programmer hone their skills through practice and repetition. A kata a day keeps the debugger away Apply a Kata daily for at least 15 minutes, by coding, refactoring and test-first,. Before you begin a Kata: Try not to read ahead. Do one task at a time. The trick is to learn to work incrementally. Make sure you only test for correct inputs. there is no need to test for invalid inputs for this kata
  • 15. Code Katas aren’t effective Doing the same thing over and over again doesn’t make us better at it When we first learned from walking it was tuff, now it’s just a repetitive process
  • 16. Lets do a string kata with
  • 17. Diverse links • TypeScript http://www.typescriptlang.org/ • Kata practices bit.ly/3sUjzK • StringCalculator in different languages bit.ly/2wma3X • Chutzpah – Javascript test runner bit.ly/qsazVS • DefinitelyTyped repositories • Github bit.ly/Shdyzn • Nuget.org http://bit.ly/W0V3bD • nodeJS TSDPM bit.ly/VMo1LQ • TypeScript Weekly http://paper.li/ronniedrengen/1386937876