Weitere ähnliche Inhalte Mehr von Somkiat Puisungnoen (20) Transformation Priority Premise (TPP)2. SPRINT3R
TEST ?
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
4. SPRINT3R
TDDer ?
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
7. SPRINT3R
As the tests get more specific,
the code gets more generic
- Uncle Bob -
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
10. เริ่มต้นกับ FizzBuzz
1, 2, Fizz, 4, Buzz, Fizz, 7,
8, Fizz, Buzz, 11, Fizz, 13,
14, FizzBuzz, 16, 17, Fizz
ถ้าตัวเลขหาร 3 ลงตัว แสดงคำว่า Fizz
ถ้าตัวเลขหาร 5 ลงตัว แสดงคำว่า Buzz
ถ้าตัวเลขหาร 3 และ 5 ลงตัว แสดงคำว่า FizzBuzz
่วนอื่นๆ แสดงค่าเลขนั้นๆ
SPRINT3R
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
11. SPRINT3R
คิดว่า code ดีแล้วหรือ ?
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
15. SPRINT3R
ในการ Refactoring code
ต้องทำควบคู่กันไปกับ
Transformation
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
17. Transformations have a priority, or a preferred ordering,
- Uncle Bob -
SPRINT3R
Transformation Priority Premise
will prevent impasses,
or long outages in the red/green/refactor cycle.
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
19. SPRINT3R
Transformation Priority
No. Transformation Name Example
1 no code -> nil no code -> null
2 nil -> simple constant null -> “1”
3 constant -> constant + “1” -> “2”
4 constant -> variable “2” -> number
5 statement -> statements number = “2” -> number = “2”; print(“Data”);
6 unconditional -> conditional no if -> if, ternary if statement
7 variable -> array dog -> [ dog, cat ]
8 array -> collection [ dog, cat ] -> { dog : “โ่งๆ”, cat : “เหมียว” }
9 statement -> tail recursion a + b -> a + recursion()
10 if -> while if( condition ) -> while( condition )
11 statement -> recursion a + recursion() -> recursion(recursion)
12 expression -> function today - birthdate -> calculateDay(birthday)
13 variable -> assignment day -> day = 10
14 case if( condition ) -> if( condition ) {} else {}
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
20. SPRINT3R
มาดูิ ทำอะไรกันไปบ้าง
No. Transformation Name FizzBuzz # 1
1 no code -> nil 1. no code -> null
2 nil -> simple constant 2. null -> “1”
3 constant -> constant +
4 constant -> variable 3. “1” -> number
5 statement -> statements
6 unconditional -> conditional 4. no if -> if(number % 3 == 0)
7 variable -> array
8 array -> collection
9 statement -> tail recursion
10 if -> while
11 statement -> recursion
12 expression -> function 6. number % 3 == 0 -> isFizz(number)
13 variable -> assignment
14 case 5. if() {} else if() else {}
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
21. SPRINT3R
คิดว่า code ดีแล้วหรือ ?
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
22. TDD + TPP
SPRINT3R
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
TPP
24. เลือก test case ที่สามารถเขียน code ให้ผ่าน
SPRINT3R
คำแนะนำ
ด้วย transformation ลำดับแรกๆ
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
26. SPRINT3R
มาดูิ ทำอะไรกันไปบ้าง
No. Transformation Name FizzBuzz # 2
1 no code -> nil no code -> null
2 nil -> simple constant null -> “1”
3 constant -> constant +
4 constant -> variable
5 statement -> statements
6 unconditional -> conditional
7 variable -> array
8 array -> collection
9 statement -> tail recursion
10 if -> while
11 statement -> recursion
12 expression -> function
13 variable -> assignment
14 case
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
32. SPRINT3R
TDD + TPP = Simple Logic
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
33. SPRINT3R
TDD + TPP = Better Code
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
34. TDD + TPP = Maintainable Code
SPRINT3R
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance