SlideShare a Scribd company logo
1 of 35
Download to read offline
About me
Name: Blues
Company: InterPay Inc.
Language: PHP
Recent Interest:
Working Effectively with
Legacy Code
Agenda
How Do I Add a Feature?
Test-Driven Development(TDD)
Programming by Difference
I Can’t Get This Class into a Test Harness
Many many cases
TDD
TDD
Time Driven Development
(TDD)
Test Driven Development
Test-driven
development cycle
Write a failing test case.
Get it to compile.
Make it pass.
Remove duplication.
Repeat.
TDD Kata
Demo TDD Kata
TDD and Legacy Code
Write a failing test case.
Get it to compile.
Make it pass.
Remove duplication.
Repeat.
Programming by
difference
Recommend Books
Test-Driven Development: by Example -
Kent Beck
Test-Driven Development: A Practical
Guide - Dave Astel
I Can’t Get This Class Into
a Test Harness
The Case of the Irritating Parameter
The Case of the Hidden Dependency
The Case of the Construction Blob
The Case of the Irritating Global Dependency
The Case of the Horrible Include Dependencies
The Case of the Onion Parameter
The Case of the Aliased Parameter
The Case of the
Irritating Parameter
Extract Interface (P.377)
Subclass and Override Method (P.418)
The Case of the Hidden
Dependency
Parameterize Constructor (P.395)
Preserve Signature (P.328)
The Case of the
Construction Blob
Supersude Instance Variable(P.421)
The Case of the Irritating
Global Dependency
Subclass and Override Method (P.418)
Introduce Static Setter (P.387)
Paramterize Method (P.399)
Pramaterize Construct (P.395)
The Case of the Horrible
Include Dependencies
Create Fake Header File (P.143)
The Case of the Onion
Parameter
Pass Null (P.123)
Extract Interface (P.377)
Extract Implementer (P.372)
The Case of the Aliased
Parameter
Subclass and Override Method (P.418)
Assignment
The Gilded Rose Kata
需求
嗨,歡迎來到鍍⾦玫瑰團隊。如您所知,
我們是⼀家⼩旅館,位於⼀線城市的黃⾦
地段,旅館老闆是艾⾥森(Allison)。我們只
銷售⾼級商品。不過每件商品都有⼀個銷
售剩餘天數。隨著時間的推移,商品的品
質會不斷下降。我們擁有⼀個可以更新庫
存訊息的系統。有位名叫River的開發⼈員
開發了這個系統,之後就離開了。你的任
務是將新功能添加到該系統中,以便我們
可以開始銷售新種類的商品。
基本規則
 所有商品(item)都有⼀個銷售剩餘天數(SellIn)
值,表⽰該商品必須在該值所代表的天數內銷
售出去。
所有商品都有⼀個品質(Quality)值,表明該商
品當前的品質。
每天結束時,系統會降低每個商品的上述兩個
值。
其他規則
 ⼀但商品過了銷售剩餘天數之後還沒未賣出,那麼其每⽇品質下降的速度就會加
倍。
商品的品質不能為負數。
陳年乾酪(Aged Brie)的品質值隨著時間的推移,不減反增。
商品的品質的上限為50。
魔法錘(Sulfuras)是⼀個傳奇商品,其銷售剩餘天數和品質都不會變化。
劇院後台通⾏證(Backstage passes),就像陳年乾酪⼀樣,其品質會隨著銷售剩
餘天數的減少⽽提⾼-當離演出開始不到10天時,品質每⽇提⾼2;當不到5天時,
品質值每⽇提⾼3,當演出結束後,品質歸0。
魔法(Conjured)商品每⽇品質下降速度是正常商品的2倍(**新需求**)
Your Job
Refactor the GildedRose Class
Add the new “Conjured” Item type
https://github.com/emilybache/GildedRose-Refactoring-Kata
https://admin.sli.do/event/53xbsxev/questions

More Related Content

Similar to 2020.04.01 DDD讀書會第三次導讀資料

Testing in Python @ Kaosiung.py 2014.05.26
Testing in Python @ Kaosiung.py 2014.05.26Testing in Python @ Kaosiung.py 2014.05.26
Testing in Python @ Kaosiung.py 2014.05.26Chun-Yu Tseng
 
.Net网络编程入门
.Net网络编程入门.Net网络编程入门
.Net网络编程入门magicshui
 
Top100summit 游戏中的自动化测试 - 金山 - 白银祖
Top100summit 游戏中的自动化测试 - 金山 - 白银祖Top100summit 游戏中的自动化测试 - 金山 - 白银祖
Top100summit 游戏中的自动化测试 - 金山 - 白银祖drewz lin
 
DevOps program 導入經驗談
DevOps program 導入經驗談DevOps program 導入經驗談
DevOps program 導入經驗談levelup31
 
開放原始碼的回收與再利用
開放原始碼的回收與再利用開放原始碼的回收與再利用
開放原始碼的回收與再利用建興 王
 
Effective.enterprise.java中文版
Effective.enterprise.java中文版Effective.enterprise.java中文版
Effective.enterprise.java中文版Peter Fan
 
[2008]网站重构 -who am i
[2008]网站重构 -who am i[2008]网站重构 -who am i
[2008]网站重构 -who am iTwinsen Liang
 
Scrum gathering 2012 shanghai 领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)
Scrum gathering 2012 shanghai  领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)Scrum gathering 2012 shanghai  领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)
Scrum gathering 2012 shanghai 领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)LetAgileFly
 
Scrum Gathering 2012 Shanghai 领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)
Scrum Gathering 2012 Shanghai  领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)Scrum Gathering 2012 Shanghai  领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)
Scrum Gathering 2012 Shanghai 领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)JoXuZi
 
我要活下來 - Ruby Junior 工程師的存活術
我要活下來 - Ruby Junior 工程師的存活術我要活下來 - Ruby Junior 工程師的存活術
我要活下來 - Ruby Junior 工程師的存活術Li Hsuan Hung
 
软件重构
软件重构软件重构
软件重构longhao
 
TDD (Test-driven development, 測試驅動開發) 基本教學
TDD (Test-driven development, 測試驅動開發) 基本教學TDD (Test-driven development, 測試驅動開發) 基本教學
TDD (Test-driven development, 測試驅動開發) 基本教學潘 冠辰
 
How to integrate GitLab CICD into B2B service
How to integrate GitLab CICD into B2B serviceHow to integrate GitLab CICD into B2B service
How to integrate GitLab CICD into B2B serviceAlex Su
 
Go 語言基礎簡介
Go 語言基礎簡介Go 語言基礎簡介
Go 語言基礎簡介Bo-Yi Wu
 
Drupal performance (in DrupalCamp Taipei)
Drupal performance (in DrupalCamp Taipei)Drupal performance (in DrupalCamp Taipei)
Drupal performance (in DrupalCamp Taipei)jimyhuang
 
Our experience to start a startup
Our experience to start a startupOur experience to start a startup
Our experience to start a startupYenwen Feng
 
Ansible & GitLab CI / CD Workshop 101 ( @Agile Tour Taipei 2017)
Ansible & GitLab CI / CD Workshop 101 ( @Agile Tour Taipei 2017)Ansible & GitLab CI / CD Workshop 101 ( @Agile Tour Taipei 2017)
Ansible & GitLab CI / CD Workshop 101 ( @Agile Tour Taipei 2017)Chen Cheng-Wei
 
[External] 2021 twhk gdsc summer boot camp student guide
[External] 2021 twhk gdsc  summer boot camp student guide [External] 2021 twhk gdsc  summer boot camp student guide
[External] 2021 twhk gdsc summer boot camp student guide shin
 

Similar to 2020.04.01 DDD讀書會第三次導讀資料 (20)

Testing in Python @ Kaosiung.py 2014.05.26
Testing in Python @ Kaosiung.py 2014.05.26Testing in Python @ Kaosiung.py 2014.05.26
Testing in Python @ Kaosiung.py 2014.05.26
 
.Net网络编程入门
.Net网络编程入门.Net网络编程入门
.Net网络编程入门
 
Top100summit 游戏中的自动化测试 - 金山 - 白银祖
Top100summit 游戏中的自动化测试 - 金山 - 白银祖Top100summit 游戏中的自动化测试 - 金山 - 白银祖
Top100summit 游戏中的自动化测试 - 金山 - 白银祖
 
DevOps program 導入經驗談
DevOps program 導入經驗談DevOps program 導入經驗談
DevOps program 導入經驗談
 
開放原始碼的回收與再利用
開放原始碼的回收與再利用開放原始碼的回收與再利用
開放原始碼的回收與再利用
 
Yii phpunit
Yii phpunitYii phpunit
Yii phpunit
 
Effective.enterprise.java中文版
Effective.enterprise.java中文版Effective.enterprise.java中文版
Effective.enterprise.java中文版
 
[2008]网站重构 -who am i
[2008]网站重构 -who am i[2008]网站重构 -who am i
[2008]网站重构 -who am i
 
Django step0
Django step0Django step0
Django step0
 
Scrum gathering 2012 shanghai 领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)
Scrum gathering 2012 shanghai  领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)Scrum gathering 2012 shanghai  领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)
Scrum gathering 2012 shanghai 领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)
 
Scrum Gathering 2012 Shanghai 领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)
Scrum Gathering 2012 Shanghai  领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)Scrum Gathering 2012 Shanghai  领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)
Scrum Gathering 2012 Shanghai 领导力与组织转型分会场演讲话题:让飞行中的敏捷软着陆(李忠利)
 
我要活下來 - Ruby Junior 工程師的存活術
我要活下來 - Ruby Junior 工程師的存活術我要活下來 - Ruby Junior 工程師的存活術
我要活下來 - Ruby Junior 工程師的存活術
 
软件重构
软件重构软件重构
软件重构
 
TDD (Test-driven development, 測試驅動開發) 基本教學
TDD (Test-driven development, 測試驅動開發) 基本教學TDD (Test-driven development, 測試驅動開發) 基本教學
TDD (Test-driven development, 測試驅動開發) 基本教學
 
How to integrate GitLab CICD into B2B service
How to integrate GitLab CICD into B2B serviceHow to integrate GitLab CICD into B2B service
How to integrate GitLab CICD into B2B service
 
Go 語言基礎簡介
Go 語言基礎簡介Go 語言基礎簡介
Go 語言基礎簡介
 
Drupal performance (in DrupalCamp Taipei)
Drupal performance (in DrupalCamp Taipei)Drupal performance (in DrupalCamp Taipei)
Drupal performance (in DrupalCamp Taipei)
 
Our experience to start a startup
Our experience to start a startupOur experience to start a startup
Our experience to start a startup
 
Ansible & GitLab CI / CD Workshop 101 ( @Agile Tour Taipei 2017)
Ansible & GitLab CI / CD Workshop 101 ( @Agile Tour Taipei 2017)Ansible & GitLab CI / CD Workshop 101 ( @Agile Tour Taipei 2017)
Ansible & GitLab CI / CD Workshop 101 ( @Agile Tour Taipei 2017)
 
[External] 2021 twhk gdsc summer boot camp student guide
[External] 2021 twhk gdsc  summer boot camp student guide [External] 2021 twhk gdsc  summer boot camp student guide
[External] 2021 twhk gdsc summer boot camp student guide
 

2020.04.01 DDD讀書會第三次導讀資料