SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 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
 

Similaire à 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
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

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