Typescript kata The TDD style 2 edition
-
Upload
ronnie-hegelund -
Category
Technology
-
view
930 -
download
2
description
Transcript of Typescript kata The TDD style 2 edition
TypeScript KataThe TDD style 2 edition
Ronnie HegelundCreator of AutoFixtureTShttp://bit.ly/XYF0Gp
Author of Enterprise development in TypeScripthttp://bit.ly/11WyKF8
http://ronniehegelund.blogspot.dk/
@ronniedrengen
活字体カタ:テスト駆動開発
About me!Ronnie HegelundTechnical Lead, Widex A/S
http://ronniehegelund.blogspot.dk/@ronniedrengen
Love all facets of software development fromTest driven development, Software Architecture, continuous delivery
Focus onWeb, 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. What is TypeScript2. Test Driven Development3. Concepts of Code kata’s4. Doing string calculator kata with
TypeScriptVisual StudioJasmine
What is TypeScript
TypeScript is a language for application scaleJavaScript development.
What is TypeScript
TypeScript is a typed superset of JavaScriptthat 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 JavaScriptAll JavaScript code is TypeScript code, simply copy and pasteAll JavaScript libraries work with TypeScript
Optional Static Types, Classes, ModulesEnable scalable application development and excellent toolingZero cost: Static types completely disappear at run-time
Ends with JavaScriptCompiles to idiomatic JavaScriptRuns in any browser or host, on any OS
What is TypeScript
Library Typings (.d.ts files)DefinitelyTyped has > 326 community library typings projects344 contributors
Tools and Build IntegrationRich IDEs: Visual Studio, Eclipse, WebStorm, Cloud9, BracketsText Editors: SublimeText, vi, Emacs, JSBinBuild Integration: ASP.NET, node.js, compile-in-client, Ruby, grunt and more
Open SourceActive development on CodePlexThousands of issues/discussions, hundreds of participants
Who’s already using TypeScript
Test-Driven Development
TDD In the simplest form
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!
Solution, Testing vs TDD
Testing
Design Implement
Test
Test-Driven Development
Design TestImplemen
t Test
How to do it
Design: figure out what you wantTest: write a test to express the design
It should FAILImplement: Write the codeTest againg:
It should PASS
Code KataUsing Code Kata’s to become a better developer
A kata a day keeps the debugger awayApply a Kata daily for at least 15 minutes, by coding, refactoring and test-first,.
Code kata is an exercise in programming that helps a programmer hone their skills through practice and repetition.
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 effectiveDoing 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