balancing object-functional design guided by tests

22
Naresh Jain @nashjain http://nareshjain.com Balancing Object-Functional Design Guided by Tests

Upload: naresh-jain

Post on 16-Feb-2017

1.602 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Balancing Object-Functional Design Guided by Tests

Naresh Jain @nashjain

http://nareshjain.com

Balancing Object-Functional Design Guided by Tests

Page 2: Balancing Object-Functional Design Guided by Tests

OO= Modelling Real World

Page 3: Balancing Object-Functional Design Guided by Tests

…And soon

Page 4: Balancing Object-Functional Design Guided by Tests
Page 5: Balancing Object-Functional Design Guided by Tests

Classic Debate

Page 6: Balancing Object-Functional Design Guided by Tests

OO Gets A Bad Name

X

Page 7: Balancing Object-Functional Design Guided by Tests

O O + F P + T D DT H I S W O R K S H O P I S A B O U T …

Page 8: Balancing Object-Functional Design Guided by Tests

A G E N D A - 1 2 0 M I N S

• Basic Setup (WebStorm, NPM, Jasmine, Karma, …)

• Live Demo of Test Driving a Comments jQuery Plugin

• Moving towards a

• Monadic (MayBe) interface and

• MVVM design pattern

• Stubbing out AJAX calls

• Next Steps…

Page 9: Balancing Object-Functional Design Guided by Tests

W E P L A N T O B U I L D T H I S …

Page 10: Balancing Object-Functional Design Guided by Tests

Add a Test

Run the Test

Make a little change

Run the Test

Refactor

Fail

Pass

Fail

Pass

TDD Rhythm Test, Code, Refactor

Page 11: Balancing Object-Functional Design Guided by Tests

B A S I C S E T U P

• cd ~/projects

• git clone [email protected]:nashjain/jQCommentDemo.git

• cd jQCommentDemo

• npm update

• sudo npm install -g karma-cli

• karma init

• Create a Simple Jasmine Spec

• run Jasmine Spec via karma test runner

Page 12: Balancing Object-Functional Design Guided by Tests

Commercial Break!

Page 13: Balancing Object-Functional Design Guided by Tests

Copyright © 2012, AgileFAQs. All Rights

Page 14: Balancing Object-Functional Design Guided by Tests

Mumbai

Page 15: Balancing Object-Functional Design Guided by Tests
Page 16: Balancing Object-Functional Design Guided by Tests
Page 17: Balancing Object-Functional Design Guided by Tests
Page 18: Balancing Object-Functional Design Guided by Tests

Tech Talks!

Page 19: Balancing Object-Functional Design Guided by Tests
Page 20: Balancing Object-Functional Design Guided by Tests

O U R P L U G I N ’ S F E AT U R E S

• Should be able to accept a comments json or an URL to fetch the comments json from server

• Should display most recent comments on top

• Private comments should be displayed only to the author of the comment

• Others should be able to like your comment

• and so on…

Page 21: Balancing Object-Functional Design Guided by Tests

R E F E R E N C E S

• https://learn.jquery.com/plugins/basic-plugin-creation/

• http://jasmine.github.io/2.3/introduction.html

• https://github.com/velesin/jasmine-jquery

• https://github.com/jasmine/jasmine-ajax

• http://karma-runner.github.io/0.13/index.html

Page 22: Balancing Object-Functional Design Guided by Tests

Naresh Jain @nashjain

http://nareshjain.com

Thank you!