SlideShare a Scribd company logo
1 of 34
Noam Katzir
21 days to production
noamk@wix.com
when you don’t know the code
New
to the
project
2 weeks
New
to the
project
I learn a piece of code
I get it
I write a dummy feature
Here’s the Code.
Make it Work. You’ve got 21 days.
2 weeks
production
Multilingual
Here’s the Code.
iframe
iframe
Wix Data
(Corvid databases API)
Wix StoresWix Stores
Wix Data
(Corvid databases API)
Wix Stores
Verticals
Get data
structures
iframe
Wix StoresWix Stores
Wix Data
(Corvid databases API)
Wix Stores
Verticals
Get data
structures
Translate
iframe
Node.js
Tests, right?
data
structure
Test
assert...
▪ Lambdas and closures everywhere
▪ Massive usage of Object literal
▪ Unsafe features like “this”
▪ Weak types
▪ Mutable state
▪ Quick and dirty syndrome
▪ There is no null/undefined safety
Javascript is freestyle
Javascript is freestyle
A lot of people
❤ it.
Javascript is freestyle
A lot of people
❤ it.
When they
leave, you get
stuck.
TDD
is not enough to figure out
a JS codebase.
Tests
Describe the
Business flow
Explain how
to use
Safe to
refactor
Provide
documentation
Encapsulation
of the Business
domain
Safety / structure
enforcement
Tests
Describe the
Business flow
Explain how
to use
Safe to
refactor
Provide
documentation
Encapsulation
of the Business
domain
Safety / structure
enforcement
Describe the
Business flow
Explain how
to use
Safe to
refactor
Provide
documentation
Types
2 weeks
production
I’ll add
types
Objects
with Types
Freestyle
Objects
1 Objects
with Types
Freestyle
Objects
*Tests & test data generator can help
Derive the top level
domain objects*
1 Objects
with Types
Freestyle
Objects
Create
Typescript interfaces
with the same
properties.
domain objects*
1 Objects
with Types
Freestyle
Objects
Scan the edges.
What does this
look like?
2
//file 1
const schemaDescriptor = {
name: 'noam',
writable: true,
displayName: 'Noam',
baseUrl: 'http://www.wix.com',
fields: []
}
calcSomethingFor(schemaDescriptor);
//file 2
function calcSomethingFor(schema) {
.....
}
Freestyle
Objects
//file 1
const schemaDescriptor = {
name: 'noam',
writable: true,
displayName: 'Noam',
baseUrl: 'http://www.wix.com',
fields: []
}
calcSomethingFor(schemaDescriptor);
//file 2
function calcSomethingFor(schema) {
.....
}
//file 1
export type SchemaDescriptor = {
name: string;
writable: boolean;
displayName: string;
baseUrl: string;
filterKey?: FilterField;
fields: SchemaField[];
}
//file 2
const schemaDescriptor: SchemaDescriptor = {
name: 'noam',
writable: true,
displayName: 'Noam',
baseUrl: 'http://www.wix.com',
fields: []
}
calcSomethingFor(schemaDescriptor);
//file 3
function calcSomethingFor(schema: SchemaDescriptor) {
.....
}
Objects
with Types
Freestyle
Objects
import {WixCodePage} from '../WixCodePage';
export const factory = component => {
const getIframeContainer = () =>
component.find('[data-hook="wix-code-wrapper"]');
const getWixCodePage = () =>
component.find(WixCodePage);
const isIframeDisplayed = () =>
getIframeContainer().length > 0;
const getHeader = () => component.find('[data-
hook="page-header"]');
return {
getIframeContainer,
isIframeDisplayed,
getWixCodePage,
getHeader
};
};
Freestyle
import {WixCodePage} from '../WixCodePage';
export const factory = component => {
const getIframeContainer = () =>
component.find('[data-hook="wix-code-wrapper"]');
const getWixCodePage = () =>
component.find(WixCodePage);
const isIframeDisplayed = () =>
getIframeContainer().length > 0;
const getHeader = () => component.find('[data-
hook="page-header"]');
return {
getIframeContainer,
isIframeDisplayed,
getWixCodePage,
getHeader
};
};
import {WixCodePage} from '../WixCodePage';
export interface PageComposerTestValidator {
getIframeContainer(): ReactWrapper;
getWixCodePage(): ReactWrapper;
isIframeDisplayed(): boolean;
getHeader(): ReactWrapper;
}
class DefaultPageComposerTestValidator implements
PageComposerTestValidator {
constructor(private readonly component: ReactWrapper,
private readonly reactComponent: React.Component) {}
getIframeContainer(): ReactWrapper {
return this.component.find('[data-hook="wix-code-wrapper"]');
}
getWixCodePage(): ReactWrapper {
return this.component.find(reactComponent);
}
isIframeDisplayed(): boolean {
return this.getIframeContainer().length > 0;
}
getHeader(): ReactWrapper {
return this.component.find('[data-hook="page-header"]');
}
}
with TypesFreestyle
1 Objects
with Types
Freestyle
Objects
Read again.
Define new
domain objects.
Refactor
2 3
18 days later...
70% of code is typed!
productionNew
to the
project
Let’s
add
types!
Types are great.
Cheap
to do
Types are great.
Why are
you NOT
using
them?
Thank You
noamk@wix.com
Q&A
noamk@wix.com

More Related Content

What's hot

Video WebChat Conference Tool
Video WebChat Conference ToolVideo WebChat Conference Tool
Video WebChat Conference Tool
Sergiu Gordienco
 
Scalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JSScalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JS
Cosmin Mereuta
 
1 serializando y deserializando datos en red
1  serializando y deserializando datos en red1  serializando y deserializando datos en red
1 serializando y deserializando datos en red
Jesús Estévez
 
Retour à la simplicité
Retour à la simplicitéRetour à la simplicité
Retour à la simplicité
Montreal JUG
 

What's hot (20)

NodeJS in Windows Azure
NodeJS in Windows AzureNodeJS in Windows Azure
NodeJS in Windows Azure
 
Video WebChat Conference Tool
Video WebChat Conference ToolVideo WebChat Conference Tool
Video WebChat Conference Tool
 
Scalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JSScalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JS
 
Java Script Basics
Java Script BasicsJava Script Basics
Java Script Basics
 
Into to Node.js: Building Fast, Scaleable Network Applications
Into to Node.js: Building Fast, Scaleable Network ApplicationsInto to Node.js: Building Fast, Scaleable Network Applications
Into to Node.js: Building Fast, Scaleable Network Applications
 
Nodejs
NodejsNodejs
Nodejs
 
1 serializando y deserializando datos en red
1  serializando y deserializando datos en red1  serializando y deserializando datos en red
1 serializando y deserializando datos en red
 
Let's build a blockchain.... in 40 minutes!
Let's build a blockchain.... in 40 minutes!Let's build a blockchain.... in 40 minutes!
Let's build a blockchain.... in 40 minutes!
 
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
 
Vert.x v3 - high performance polyglot application toolkit
Vert.x v3 - high performance  polyglot application toolkitVert.x v3 - high performance  polyglot application toolkit
Vert.x v3 - high performance polyglot application toolkit
 
Retour à la simplicité
Retour à la simplicitéRetour à la simplicité
Retour à la simplicité
 
Understanding the Node.js Platform
Understanding the Node.js PlatformUnderstanding the Node.js Platform
Understanding the Node.js Platform
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Let's Build A Blockchain... in 40 minutes!
Let's Build A Blockchain... in 40 minutes!Let's Build A Blockchain... in 40 minutes!
Let's Build A Blockchain... in 40 minutes!
 
Future of NodeJS
Future of NodeJSFuture of NodeJS
Future of NodeJS
 
From Node.js to Design Patterns
From Node.js to Design Patterns From Node.js to Design Patterns
From Node.js to Design Patterns
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Building CRUD Wrappers
Building CRUD WrappersBuilding CRUD Wrappers
Building CRUD Wrappers
 
Building Java and Android apps on the blockchain
Building Java and Android apps on the blockchain Building Java and Android apps on the blockchain
Building Java and Android apps on the blockchain
 
JS & NodeJS - An Introduction
JS & NodeJS - An IntroductionJS & NodeJS - An Introduction
JS & NodeJS - An Introduction
 

Similar to TDD With Typescript - Noam Katzir

Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
FIWARE
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
Fermin Galan
 

Similar to TDD With Typescript - Noam Katzir (20)

Using the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service ClientsUsing the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service Clients
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developers
 
How to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindHow to write clean & testable code without losing your mind
How to write clean & testable code without losing your mind
 
Swift Micro-services and AWS Technologies
Swift Micro-services and AWS TechnologiesSwift Micro-services and AWS Technologies
Swift Micro-services and AWS Technologies
 
Reversing JavaScript
Reversing JavaScriptReversing JavaScript
Reversing JavaScript
 
How to make Ajax work for you
How to make Ajax work for youHow to make Ajax work for you
How to make Ajax work for you
 
Metaprogramming in JavaScript
Metaprogramming in JavaScriptMetaprogramming in JavaScript
Metaprogramming in JavaScript
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 
BOF2644 Developing Java EE 7 Scala apps
BOF2644 Developing Java EE 7 Scala appsBOF2644 Developing Java EE 7 Scala apps
BOF2644 Developing Java EE 7 Scala apps
 
Container Runtime Security with Falco
Container Runtime Security with FalcoContainer Runtime Security with Falco
Container Runtime Security with Falco
 
Talk about html5 security
Talk about html5 securityTalk about html5 security
Talk about html5 security
 
Sanjeev ghai 12
Sanjeev ghai 12Sanjeev ghai 12
Sanjeev ghai 12
 
Everything as a Code / Александр Тарасов (Одноклассники)
Everything as a Code / Александр Тарасов (Одноклассники)Everything as a Code / Александр Тарасов (Одноклассники)
Everything as a Code / Александр Тарасов (Одноклассники)
 
Everything as a code
Everything as a codeEverything as a code
Everything as a code
 
Painless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldPainless Persistence in a Disconnected World
Painless Persistence in a Disconnected World
 
Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The When
 
Browser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmBrowser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholm
 

More from Wix Engineering

More from Wix Engineering (7)

Tipping the Scale - Eyal Eizenberg
Tipping the Scale - Eyal EizenbergTipping the Scale - Eyal Eizenberg
Tipping the Scale - Eyal Eizenberg
 
Focusing on A and E in Chromatic Scale - Jenia Barabanov
Focusing on A and E in Chromatic Scale - Jenia BarabanovFocusing on A and E in Chromatic Scale - Jenia Barabanov
Focusing on A and E in Chromatic Scale - Jenia Barabanov
 
Exactly Once Delivery - Natan Silnitsky
Exactly Once Delivery - Natan SilnitskyExactly Once Delivery - Natan Silnitsky
Exactly Once Delivery - Natan Silnitsky
 
NoSQL in SQL - Lior Altarescu
NoSQL in SQL - Lior Altarescu NoSQL in SQL - Lior Altarescu
NoSQL in SQL - Lior Altarescu
 
Wix Machine Learning - Ran Romano
Wix Machine Learning - Ran RomanoWix Machine Learning - Ran Romano
Wix Machine Learning - Ran Romano
 
Building a Large Java Codebase with Bazel - Natan Silnitsky
Building a Large Java Codebase with Bazel - Natan Silnitsky Building a Large Java Codebase with Bazel - Natan Silnitsky
Building a Large Java Codebase with Bazel - Natan Silnitsky
 
Migrating to a Bazel-based CI System: 6 Learnings - Or Shachar
Migrating to a Bazel-based CI System: 6 Learnings - Or ShacharMigrating to a Bazel-based CI System: 6 Learnings - Or Shachar
Migrating to a Bazel-based CI System: 6 Learnings - Or Shachar
 

Recently uploaded

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+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 Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
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
 

Recently uploaded (20)

WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto 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...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
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
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
%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
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%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
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
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?
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
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...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
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
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 

TDD With Typescript - Noam Katzir