SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
P3 TDD Calculator
Enginyeria del Software 3
1
@drpicox — 2020
Assignment
• Individual in Javascript

• https://classroom.github.com/a/-SxHairB

• You have to resolve all commented tests in order

• do 1 commit for each solved test
2
How to Start JS
• https://code.visualstudio.com/ 

• https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig 

• https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint 

• https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare 

• https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode

• Be sure that you enable prettier as "Default Formatter" and "Format On Save"

• https://nodejs.org/en/ v12

• https://yarnpkg.com/ 

• Execute: "yarn" and then "yarn test" in the command shell
3
First steps example
4
Before everything: read the README.md
5
Before everything: read the README.md
6
Before everything: read the README.md
7
Setup: run the command "yarn"
8
Start: run "yarn test"
9
Solving test table line 1: looking the required sequence
10
Solving test table line 1: read the error
11
Solving test table line 1: understand the error
12
Solving test table line 1: error fixed
13
Solving test table line 1: commit
14
Solving test table line 1: commit
15
Solving test table line 2: move next line from comment
16
Solving test table line 2: move next line from comment
17
Solving test table line 2: read the error
18
Solving test table line 2: fix the error
19
Solving test table line 2: iterate until all errors are fixed
20
Solving test table line 2: iterate until all errors are fixed
21
Solving test table line 2: commit
22
Solving test table line 2: commit
23
Iterate and commit solved line by solved line until finish
24
Iterate and commit solved line by solved line until finish
25
Sequences
• They are strings in which each character is a key down:

ex: "2+4=[6]"
26
input(number)
plus()
equal()
times()
getDisplay(): number
factorial()
Sequences
"56[56]"
c.input(5)
c.input(6)
expect(c.getDisplay()).toBe(56)
"4![24]"
c.input(4)
c.factorial()
expect(c.getDisplay()).toBe(24)
27
Sequences
"3+4=[7]"
c.input(3)
c.plus()
c.input(4)
c.equal()
expect(c.getDisplay()).toBe(7)
"12+[12]"
c.input(1)
c.input(2)
c.plus()
expect(c.getDisplay()).toBe(12)
28
Javascript 🗑 Course
• Syntaxis similar to Java

• You should be able to learn basics in one weekend

• Here I explain here minimal basics for this assignment
29
https://www.slideshare.net/DavidRdenasPic/introduction-to-web-programming-for-java-and-c-programmers-by-drpicox
https://github.com/drpicox/learn-javascript-bytesting-jest
Types
// Javascript basic types are:
const number = 3
const string = "hello"
const boolean = true
const array = [1, 2, 3]
const object = { name: "David" }
const addFunction = (a, b) => a + b
30
Types
// Javascript is typed in runtime:
let variable
expect(typeof variable).toBe("undefined")
variable = 3
expect(typeof variable).toBe("number")
variable = "hello"
expect(typeof variable).toBe("string")
variable = { name: "David" }
expect(typeof variable).toBe("object")
31
Functions
// Functions are objects
function add(a, b) {
return a + b
}
const inc = (x) => add(x, 1)
expect(typeof add).toBe("function")
expect(typeof inc).toBe("function")
// Execute a function with parenthesis
expect(add(2, 3)).toBe(5)
expect(inc(6)).toBe(7)
// Assign without parenthesis (like a pointer/reference)
const plus = add;
expect(typeof plus).toBe("function")
expect(plus(2, 3)).toBe(5)
32
Classes
// Classes are objects, and constructors functions
class Circle {}
const circle = new Circle()
expect(typeof circle).toBe("object")
expect(typeof Circle).toBe("function")
33
Classes
// Classes members are always public
class Circle {
radius = 1
}
const circle = new Circle()
expect(typeof circle.radius).toBe("number")
expect(circle.radius).toBe(1)
circle.radius = 3
expect(circle.radius).toBe(3)
34
Classes
// Classes methods access with this
class Circle {
radius = 1
setRadius(newRadius) {
this.radius = newRadius
}
getRadius() {
return this.radius
}
}
const circle = new Circle()
expect(typeof circle.setRadius).toBe("function")
expect(typeof circle.getRadius).toBe("function")
circle.setRadius(5)
expect(circle.getRadius()).toBe(5)
expect(typeof circle.getRadius()).toBe("number")
35
Classes
// Classes methods use this to access other methods
class Circle {
radius = 1
getRadius() {
return this.radius
}
draw() {
const radius = this.getRadius();
console.log(`circle of ${radius}`)
}
}
36
Classes
// Classes members are dynamic
class Circle {
setRadius(newRadius) {
this.radius = newRadius
}
}
const circle = new Circle()
expect(typeof circle.radius).toBe("undefined")
expect(typeof circle.color).toBe("undefined")
circle.setRadius(7)
circle.color = "red"
expect(circle.radius).toBe(7)
expect(circle.color).toBe("red")
37
Classes
// Classes members can be accidentally overwritten
class Circle {
setRadius(newRadius) {
this.radius = newRadius
}
radius() {
return this.radius
}
}
const circle = new Circle()
expect(typeof circle.radius).toBe("function")
circle.setRadius(3)
expect(typeof circle.radius).toBe("number")
38
Interfaces
// There are no interfaces in javascript, use convention
// ex: interface Shape { draw(size:number); }
class Box {
draw(size) {
// ... draw a box
}
}
class Circle {
draw(size) {
// ... draw a circle
}
}
const shapes = [new Box(), new Circle()]
shapes.forEach((shape) => shape.draw(10))
39
Related Videos
TDD Live Example for a Multiplication Algorithm
(aka: do not use eval to solve this assignment)
https://www.youtube.com/watch?v=VW4hHaid3PE
Not a TDD for Multiplication Algorithm
https://www.youtube.com/watch?v=SMNqmO-bfRY
Also not a TDD for Multiplication Algorithm
https://www.youtube.com/watch?v=2fxsgEOUQmU
40
41

Contenu connexe

Tendances

Сергей Больщиков "Protractor Tips & Tricks"
Сергей Больщиков "Protractor Tips & Tricks"Сергей Больщиков "Protractor Tips & Tricks"
Сергей Больщиков "Protractor Tips & Tricks"Fwdays
 
Web ui tests examples with selenide, nselene, selene & capybara
Web ui tests examples with  selenide, nselene, selene & capybaraWeb ui tests examples with  selenide, nselene, selene & capybara
Web ui tests examples with selenide, nselene, selene & capybaraIakiv Kramarenko
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesAnkit Rastogi
 
#ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"
#ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"#ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"
#ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"epamspb
 
Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]Iakiv Kramarenko
 
Testable, Object-Oriented JavaScript
Testable, Object-Oriented JavaScriptTestable, Object-Oriented JavaScript
Testable, Object-Oriented JavaScriptJon Kruger
 
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperVenturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperJon Kruger
 
JavaScript APIs you’ve never heard of (and some you have)
JavaScript APIs you’ve never heard of (and some you have)JavaScript APIs you’ve never heard of (and some you have)
JavaScript APIs you’ve never heard of (and some you have)Nicholas Zakas
 
React Native: JS MVC Meetup #15
React Native: JS MVC Meetup #15React Native: JS MVC Meetup #15
React Native: JS MVC Meetup #15Rob Gietema
 
Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Iakiv Kramarenko
 
React mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche EheReact mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche Eheinovex GmbH
 

Tendances (20)

Сергей Больщиков "Protractor Tips & Tricks"
Сергей Больщиков "Protractor Tips & Tricks"Сергей Больщиков "Protractor Tips & Tricks"
Сергей Больщиков "Protractor Tips & Tricks"
 
Web ui tests examples with selenide, nselene, selene & capybara
Web ui tests examples with  selenide, nselene, selene & capybaraWeb ui tests examples with  selenide, nselene, selene & capybara
Web ui tests examples with selenide, nselene, selene & capybara
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practices
 
#ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"
#ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"#ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"
#ITsubbotnik Spring 2017: Roman Iovlev "Java edge in test automation"
 
Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]
 
Testable, Object-Oriented JavaScript
Testable, Object-Oriented JavaScriptTestable, Object-Oriented JavaScript
Testable, Object-Oriented JavaScript
 
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperVenturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
 
JavaScript APIs you’ve never heard of (and some you have)
JavaScript APIs you’ve never heard of (and some you have)JavaScript APIs you’ve never heard of (and some you have)
JavaScript APIs you’ve never heard of (and some you have)
 
ReactJS
ReactJSReactJS
ReactJS
 
React Native: JS MVC Meetup #15
React Native: JS MVC Meetup #15React Native: JS MVC Meetup #15
React Native: JS MVC Meetup #15
 
Agile Android
Agile AndroidAgile Android
Agile Android
 
Celery
CeleryCelery
Celery
 
Easy Button
Easy ButtonEasy Button
Easy Button
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
JDK Power Tools
JDK Power ToolsJDK Power Tools
JDK Power Tools
 
Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015
 
D3_Tuto_GD
D3_Tuto_GDD3_Tuto_GD
D3_Tuto_GD
 
Agile Swift
Agile SwiftAgile Swift
Agile Swift
 
KISS Automation.py
KISS Automation.pyKISS Automation.py
KISS Automation.py
 
React mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche EheReact mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche Ehe
 

Similaire à P3 TDD Calculator Guide

Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to JavascriptAnjan Banda
 
Front End Development: The Important Parts
Front End Development: The Important PartsFront End Development: The Important Parts
Front End Development: The Important PartsSergey Bolshchikov
 
Alloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLonAlloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLonFokke Zandbergen
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...Doug Jones
 
Friend this-new&delete
Friend this-new&deleteFriend this-new&delete
Friend this-new&deleteShehzad Rizwan
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기경주 전
 
Intro to javascript (6:27)
Intro to javascript (6:27)Intro to javascript (6:27)
Intro to javascript (6:27)David Coulter
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 
Adobe analytics implementation secret hacks
Adobe analytics implementation secret hacksAdobe analytics implementation secret hacks
Adobe analytics implementation secret hacksAlban Gérôme
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e bigAndy Peterson
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF SummitOrtus Solutions, Corp
 

Similaire à P3 TDD Calculator Guide (20)

Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
Front End Development: The Important Parts
Front End Development: The Important PartsFront End Development: The Important Parts
Front End Development: The Important Parts
 
Alloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLonAlloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLon
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
Sbt for mere mortals
Sbt for mere mortalsSbt for mere mortals
Sbt for mere mortals
 
Wt unit 5
Wt unit 5Wt unit 5
Wt unit 5
 
Oojs 1.1
Oojs 1.1Oojs 1.1
Oojs 1.1
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
 
Javascript
JavascriptJavascript
Javascript
 
Friend this-new&delete
Friend this-new&deleteFriend this-new&delete
Friend this-new&delete
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기
 
Intro to javascript (6:27)
Intro to javascript (6:27)Intro to javascript (6:27)
Intro to javascript (6:27)
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
Adobe analytics implementation secret hacks
Adobe analytics implementation secret hacksAdobe analytics implementation secret hacks
Adobe analytics implementation secret hacks
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
27javascript
27javascript27javascript
27javascript
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
 

Plus de David Rodenas

TDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDDTDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDDDavid Rodenas
 
TDD CrashCourse Part1: Testing
TDD CrashCourse Part1: TestingTDD CrashCourse Part1: Testing
TDD CrashCourse Part1: TestingDavid Rodenas
 
TDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD TechniquesTDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD TechniquesDavid Rodenas
 
TDD CrashCourse Part4: Improving Testing
TDD CrashCourse Part4: Improving TestingTDD CrashCourse Part4: Improving Testing
TDD CrashCourse Part4: Improving TestingDavid Rodenas
 
Be professional: We Rule the World
Be professional: We Rule the WorldBe professional: We Rule the World
Be professional: We Rule the WorldDavid Rodenas
 
ES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game KataES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game KataDavid Rodenas
 
ES3-2020-06 Test Driven Development (TDD)
ES3-2020-06 Test Driven Development (TDD)ES3-2020-06 Test Driven Development (TDD)
ES3-2020-06 Test Driven Development (TDD)David Rodenas
 
ReactJS for Programmers
ReactJS for ProgrammersReactJS for Programmers
ReactJS for ProgrammersDavid Rodenas
 
Basic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersBasic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersDavid Rodenas
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxDavid Rodenas
 
From high school to university and work
From high school to university and workFrom high school to university and work
From high school to university and workDavid Rodenas
 
Modules in angular 2.0 beta.1
Modules in angular 2.0 beta.1Modules in angular 2.0 beta.1
Modules in angular 2.0 beta.1David Rodenas
 
Freelance i Enginyeria
Freelance i EnginyeriaFreelance i Enginyeria
Freelance i EnginyeriaDavid Rodenas
 
Angular 1.X Community and API Decissions
Angular 1.X Community and API DecissionsAngular 1.X Community and API Decissions
Angular 1.X Community and API DecissionsDavid Rodenas
 
Mvc - Model: the great forgotten
Mvc - Model: the great forgottenMvc - Model: the great forgotten
Mvc - Model: the great forgottenDavid Rodenas
 
(automatic) Testing: from business to university and back
(automatic) Testing: from business to university and back(automatic) Testing: from business to university and back
(automatic) Testing: from business to university and backDavid Rodenas
 

Plus de David Rodenas (20)

TDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDDTDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDD
 
TDD CrashCourse Part1: Testing
TDD CrashCourse Part1: TestingTDD CrashCourse Part1: Testing
TDD CrashCourse Part1: Testing
 
TDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD TechniquesTDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD Techniques
 
TDD CrashCourse Part4: Improving Testing
TDD CrashCourse Part4: Improving TestingTDD CrashCourse Part4: Improving Testing
TDD CrashCourse Part4: Improving Testing
 
Be professional: We Rule the World
Be professional: We Rule the WorldBe professional: We Rule the World
Be professional: We Rule the World
 
ES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game KataES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game Kata
 
ES3-2020-06 Test Driven Development (TDD)
ES3-2020-06 Test Driven Development (TDD)ES3-2020-06 Test Driven Development (TDD)
ES3-2020-06 Test Driven Development (TDD)
 
ES3-2020-05 Testing
ES3-2020-05 TestingES3-2020-05 Testing
ES3-2020-05 Testing
 
ReactJS for Programmers
ReactJS for ProgrammersReactJS for Programmers
ReactJS for Programmers
 
Vespres
VespresVespres
Vespres
 
Faster web pages
Faster web pagesFaster web pages
Faster web pages
 
Basic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersBasic Tutorial of React for Programmers
Basic Tutorial of React for Programmers
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicox
 
From high school to university and work
From high school to university and workFrom high school to university and work
From high school to university and work
 
Modules in angular 2.0 beta.1
Modules in angular 2.0 beta.1Modules in angular 2.0 beta.1
Modules in angular 2.0 beta.1
 
Freelance i Enginyeria
Freelance i EnginyeriaFreelance i Enginyeria
Freelance i Enginyeria
 
Angular 1.X Community and API Decissions
Angular 1.X Community and API DecissionsAngular 1.X Community and API Decissions
Angular 1.X Community and API Decissions
 
MVS: An angular MVC
MVS: An angular MVCMVS: An angular MVC
MVS: An angular MVC
 
Mvc - Model: the great forgotten
Mvc - Model: the great forgottenMvc - Model: the great forgotten
Mvc - Model: the great forgotten
 
(automatic) Testing: from business to university and back
(automatic) Testing: from business to university and back(automatic) Testing: from business to university and back
(automatic) Testing: from business to university and back
 

Dernier

Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 

Dernier (20)

Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 

P3 TDD Calculator Guide

  • 1. P3 TDD Calculator Enginyeria del Software 3 1 @drpicox — 2020
  • 2. Assignment • Individual in Javascript • https://classroom.github.com/a/-SxHairB • You have to resolve all commented tests in order • do 1 commit for each solved test 2
  • 3. How to Start JS • https://code.visualstudio.com/ • https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig • https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint • https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare • https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode • Be sure that you enable prettier as "Default Formatter" and "Format On Save" • https://nodejs.org/en/ v12 • https://yarnpkg.com/ • Execute: "yarn" and then "yarn test" in the command shell 3
  • 5. Before everything: read the README.md 5
  • 6. Before everything: read the README.md 6
  • 7. Before everything: read the README.md 7
  • 8. Setup: run the command "yarn" 8
  • 10. Solving test table line 1: looking the required sequence 10
  • 11. Solving test table line 1: read the error 11
  • 12. Solving test table line 1: understand the error 12
  • 13. Solving test table line 1: error fixed 13
  • 14. Solving test table line 1: commit 14
  • 15. Solving test table line 1: commit 15
  • 16. Solving test table line 2: move next line from comment 16
  • 17. Solving test table line 2: move next line from comment 17
  • 18. Solving test table line 2: read the error 18
  • 19. Solving test table line 2: fix the error 19
  • 20. Solving test table line 2: iterate until all errors are fixed 20
  • 21. Solving test table line 2: iterate until all errors are fixed 21
  • 22. Solving test table line 2: commit 22
  • 23. Solving test table line 2: commit 23
  • 24. Iterate and commit solved line by solved line until finish 24
  • 25. Iterate and commit solved line by solved line until finish 25
  • 26. Sequences • They are strings in which each character is a key down:
 ex: "2+4=[6]" 26 input(number) plus() equal() times() getDisplay(): number factorial()
  • 29. Javascript 🗑 Course • Syntaxis similar to Java • You should be able to learn basics in one weekend • Here I explain here minimal basics for this assignment 29 https://www.slideshare.net/DavidRdenasPic/introduction-to-web-programming-for-java-and-c-programmers-by-drpicox https://github.com/drpicox/learn-javascript-bytesting-jest
  • 30. Types // Javascript basic types are: const number = 3 const string = "hello" const boolean = true const array = [1, 2, 3] const object = { name: "David" } const addFunction = (a, b) => a + b 30
  • 31. Types // Javascript is typed in runtime: let variable expect(typeof variable).toBe("undefined") variable = 3 expect(typeof variable).toBe("number") variable = "hello" expect(typeof variable).toBe("string") variable = { name: "David" } expect(typeof variable).toBe("object") 31
  • 32. Functions // Functions are objects function add(a, b) { return a + b } const inc = (x) => add(x, 1) expect(typeof add).toBe("function") expect(typeof inc).toBe("function") // Execute a function with parenthesis expect(add(2, 3)).toBe(5) expect(inc(6)).toBe(7) // Assign without parenthesis (like a pointer/reference) const plus = add; expect(typeof plus).toBe("function") expect(plus(2, 3)).toBe(5) 32
  • 33. Classes // Classes are objects, and constructors functions class Circle {} const circle = new Circle() expect(typeof circle).toBe("object") expect(typeof Circle).toBe("function") 33
  • 34. Classes // Classes members are always public class Circle { radius = 1 } const circle = new Circle() expect(typeof circle.radius).toBe("number") expect(circle.radius).toBe(1) circle.radius = 3 expect(circle.radius).toBe(3) 34
  • 35. Classes // Classes methods access with this class Circle { radius = 1 setRadius(newRadius) { this.radius = newRadius } getRadius() { return this.radius } } const circle = new Circle() expect(typeof circle.setRadius).toBe("function") expect(typeof circle.getRadius).toBe("function") circle.setRadius(5) expect(circle.getRadius()).toBe(5) expect(typeof circle.getRadius()).toBe("number") 35
  • 36. Classes // Classes methods use this to access other methods class Circle { radius = 1 getRadius() { return this.radius } draw() { const radius = this.getRadius(); console.log(`circle of ${radius}`) } } 36
  • 37. Classes // Classes members are dynamic class Circle { setRadius(newRadius) { this.radius = newRadius } } const circle = new Circle() expect(typeof circle.radius).toBe("undefined") expect(typeof circle.color).toBe("undefined") circle.setRadius(7) circle.color = "red" expect(circle.radius).toBe(7) expect(circle.color).toBe("red") 37
  • 38. Classes // Classes members can be accidentally overwritten class Circle { setRadius(newRadius) { this.radius = newRadius } radius() { return this.radius } } const circle = new Circle() expect(typeof circle.radius).toBe("function") circle.setRadius(3) expect(typeof circle.radius).toBe("number") 38
  • 39. Interfaces // There are no interfaces in javascript, use convention // ex: interface Shape { draw(size:number); } class Box { draw(size) { // ... draw a box } } class Circle { draw(size) { // ... draw a circle } } const shapes = [new Box(), new Circle()] shapes.forEach((shape) => shape.draw(10)) 39
  • 40. Related Videos TDD Live Example for a Multiplication Algorithm (aka: do not use eval to solve this assignment) https://www.youtube.com/watch?v=VW4hHaid3PE Not a TDD for Multiplication Algorithm https://www.youtube.com/watch?v=SMNqmO-bfRY Also not a TDD for Multiplication Algorithm https://www.youtube.com/watch?v=2fxsgEOUQmU 40
  • 41. 41