Balancing Object-Functional Design Guided by Tests
-
Upload
naresh-jain -
Category
Software
-
view
1.604 -
download
1
Transcript of Balancing Object-Functional Design Guided by Tests
Naresh Jain @nashjain
http://nareshjain.com
Balancing Object-Functional Design Guided by Tests
OO= Modelling Real World
…And soon
Classic Debate
OO Gets A Bad Name
X
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 …
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…
W E P L A N T O B U I L D T H I S …
Add a Test
Run the Test
Make a little change
Run the Test
Refactor
Fail
Pass
Fail
Pass
TDD Rhythm Test, Code, Refactor
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
Commercial Break!
Copyright © 2012, AgileFAQs. All Rights
Mumbai
Tech Talks!
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…
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