SlideShare a Scribd company logo
1 of 37
Download to read offline
Transformation Priority Premise 
@somkiat.cc 
SPRINT3R 
#CODEMANIA01 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
TEST ? 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
คุณใ๡้เวลานานเท่าไร 
debugging code ? 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
TDDer ? 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
TDD CYCLE 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
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
SPRINT3R 
เดินก้าวเล็กๆ 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
มาหัดเดินกัน 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
เริ่มต้นกับ 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
SPRINT3R 
คิดว่า code ดีแล้วหรือ ? 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
Refactoring 
เปลี่ยนแปลงโครงสร้าง code 
ด้วยวิธีการเรียบง่าย 
ไม่ใ๡่การเปลี่ยนพฤติกรรม 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
ในการ Refactoring code 
ต้องทำควบคู่กันไปกับ 
Transformation 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
Transformation 
วิธีการเรียบง่าย 
๤ำหรับเปลี่ยนพฤติกรรมภายในของ code 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
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
SPRINT3R 
Transformation Priority 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
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
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
SPRINT3R 
คิดว่า code ดีแล้วหรือ ? 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
TDD + TPP 
SPRINT3R 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance 
TPP
SPRINT3R 
คำแนะนำ 
เลือกการ Transformation ลำดับแรกๆ 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
เลือก test case ที่สามารถเขียน code ให้ผ่าน 
SPRINT3R 
คำแนะนำ 
ด้วย transformation ลำดับแรกๆ 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
ลองกันใหม่ 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
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
SPRINT3R 
TPP นำเราไปพบอะไร ? 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
ได้แบบนี้ใ๡่ไหม ? 
SPRINT3R 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
เราสร้าง feature อย่างไร 
SPRINT3R 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
TDD + TPP = Simple Logic 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
TDD + TPP = Better Code 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
TDD + TPP = Maintainable Code 
SPRINT3R 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
ทำให้การ Transformtion ได้ถูกต้อง 
SPRINT3R 
Test ที่ถูกต้อง 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
แหล่งอ้างอิง 
SPRINT3R 
http://blog.8thlight.com/uncle-bob/2013/05/27/ 
TheTransformationPriorityPremise.html 
http://blog.8thlight.com/uncle-bob/2013/05/27/ 
TransformationPriorityAndSorting.html 
https://github.com/up1/kata.tpp.fizzbuzz 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance
SPRINT3R 
ถามมา ตอบไป 
Siam Chamnankit Co., Ltd., Odd-e (Thailand) Co., Ltd. and Alliance

More Related Content

Viewers also liked

To C
To CTo C
To C
rxx
 
Michelle M
Michelle MMichelle M
Michelle M
mrounds5
 
PROEXPOSURE photographer Ashenafi Damtew
PROEXPOSURE photographer Ashenafi Damtew PROEXPOSURE photographer Ashenafi Damtew
PROEXPOSURE photographer Ashenafi Damtew
PROEXPOSURE CIC
 
Grace’S Scrapbook Of The 60’S
Grace’S Scrapbook Of The 60’SGrace’S Scrapbook Of The 60’S
Grace’S Scrapbook Of The 60’S
mrounds5
 
Final At Quicker Speed
Final At Quicker SpeedFinal At Quicker Speed
Final At Quicker Speed
jaspang
 

Viewers also liked (20)

The Windsurfing Trip
The Windsurfing TripThe Windsurfing Trip
The Windsurfing Trip
 
Social mediastrategie in 8 stappen
Social mediastrategie in 8 stappenSocial mediastrategie in 8 stappen
Social mediastrategie in 8 stappen
 
Ontwikkelingen van en in de socialprofitsector
Ontwikkelingen van en in de socialprofitsectorOntwikkelingen van en in de socialprofitsector
Ontwikkelingen van en in de socialprofitsector
 
La empresa
La empresaLa empresa
La empresa
 
To C
To CTo C
To C
 
Национальные Архивы США: Введение в типовые перечни документов с указанием ср...
Национальные Архивы США: Введение в типовые перечни документов с указанием ср...Национальные Архивы США: Введение в типовые перечни документов с указанием ср...
Национальные Архивы США: Введение в типовые перечни документов с указанием ср...
 
Cus D'Amato
Cus D'AmatoCus D'Amato
Cus D'Amato
 
Class 6 Technical Analysis of Stocks and Markets
Class 6 Technical Analysis of Stocks and MarketsClass 6 Technical Analysis of Stocks and Markets
Class 6 Technical Analysis of Stocks and Markets
 
Economics 6
Economics 6Economics 6
Economics 6
 
Michelle M
Michelle MMichelle M
Michelle M
 
Geeky Academy Week 3 :: Vagrant + Puppet
Geeky Academy Week 3 :: Vagrant + PuppetGeeky Academy Week 3 :: Vagrant + Puppet
Geeky Academy Week 3 :: Vagrant + Puppet
 
Light-Cream
Light-CreamLight-Cream
Light-Cream
 
Проблемы взаимоотношений служб ИТ и ДОУ: текущее состояние и перспективы
Проблемы взаимоотношений служб ИТ и ДОУ: текущее состояние и перспективыПроблемы взаимоотношений служб ИТ и ДОУ: текущее состояние и перспективы
Проблемы взаимоотношений служб ИТ и ДОУ: текущее состояние и перспективы
 
PROEXPOSURE photographer Ashenafi Damtew
PROEXPOSURE photographer Ashenafi Damtew PROEXPOSURE photographer Ashenafi Damtew
PROEXPOSURE photographer Ashenafi Damtew
 
Fox Terrier - Alexei
Fox Terrier - AlexeiFox Terrier - Alexei
Fox Terrier - Alexei
 
Grace’S Scrapbook Of The 60’S
Grace’S Scrapbook Of The 60’SGrace’S Scrapbook Of The 60’S
Grace’S Scrapbook Of The 60’S
 
Overheidsbeleid en innoverend werken - Gie Van den Eeckhaut
Overheidsbeleid en innoverend werken - Gie Van den EeckhautOverheidsbeleid en innoverend werken - Gie Van den Eeckhaut
Overheidsbeleid en innoverend werken - Gie Van den Eeckhaut
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Simone[1]
Simone[1]Simone[1]
Simone[1]
 
Final At Quicker Speed
Final At Quicker SpeedFinal At Quicker Speed
Final At Quicker Speed
 

More from Somkiat Puisungnoen

More from Somkiat Puisungnoen (20)

Next of Java 2022
Next of Java 2022Next of Java 2022
Next of Java 2022
 
Sck spring-reactive
Sck spring-reactiveSck spring-reactive
Sck spring-reactive
 
Part 2 :: Spring Boot testing
Part 2 :: Spring Boot testingPart 2 :: Spring Boot testing
Part 2 :: Spring Boot testing
 
vTalk#1 Microservices with Spring Boot
vTalk#1 Microservices with Spring BootvTalk#1 Microservices with Spring Boot
vTalk#1 Microservices with Spring Boot
 
Lesson learned from React native and Flutter
Lesson learned from React native and FlutterLesson learned from React native and Flutter
Lesson learned from React native and Flutter
 
devops
devops devops
devops
 
Angular :: basic tuning performance
Angular :: basic tuning performanceAngular :: basic tuning performance
Angular :: basic tuning performance
 
Shared code between projects
Shared code between projectsShared code between projects
Shared code between projects
 
Distributed Tracing
Distributed Tracing Distributed Tracing
Distributed Tracing
 
Manage data of service
Manage data of serviceManage data of service
Manage data of service
 
RobotFramework Meetup at Thailand #2
RobotFramework Meetup at Thailand #2RobotFramework Meetup at Thailand #2
RobotFramework Meetup at Thailand #2
 
Visual testing
Visual testingVisual testing
Visual testing
 
Cloud Native App
Cloud Native AppCloud Native App
Cloud Native App
 
Wordpress for Newbie
Wordpress for NewbieWordpress for Newbie
Wordpress for Newbie
 
Sck Agile in Real World
Sck Agile in Real WorldSck Agile in Real World
Sck Agile in Real World
 
Clean you code
Clean you codeClean you code
Clean you code
 
SCK Firestore at CNX
SCK Firestore at CNXSCK Firestore at CNX
SCK Firestore at CNX
 
Unhappiness Developer
Unhappiness DeveloperUnhappiness Developer
Unhappiness Developer
 
The Beauty of BAD code
The Beauty of  BAD codeThe Beauty of  BAD code
The Beauty of BAD code
 
React in the right way
React in the right wayReact in the right way
React in the right way
 

Transformation Priority Premise (TPP)