Typescript kata The TDD style 2 edition


Published on

Fundamental TypeScript, Test-Driven development and the concept of code kata's

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Typescript kata The TDD style 2 edition

  1. 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. 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. 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. 4. What is TypeScript TypeScript is a language for application scale JavaScript development.
  5. 5. What is TypeScript TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open Source.
  6. 6. What is TypeScript
  7. 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. 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. 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. 10. Who’s already using TypeScript
  11. 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. 12. Solution, Testing vs TDD Testing Test-Driven Development Design Design Test Implement Implement Test Test
  13. 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. 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. 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. 16. Lets do a string kata with
  17. 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
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.