【從學員練習影片觀察到一個關於 TDD 的有趣現象】
極速開發的課後練習作業,雖說重點是放在極速開發要學習的技巧與刻意練習的模型,但開發的方式、順序也是刻意安排成類似 TDD 的進行方式,來讓生產力最大化(TDD 本來就是幫助開發的,不是幫助測試的)
我從2位第一次上我課的學員(當然就是 #極速開發,代表他們沒上過#單元測試 跟 #TDD與持續重構),雖然他們是照著示範影片、上課教學用 TDD 在寫整個 tennis 的過程,但從他們執行測試的時間點就可以發現:
「他是用測試來驗證 production code 的正確性」,即使他先寫了測試,也不先執行,沒有看到紅燈,每次都等到 production code 寫完了,應該要綠燈時,才執行測試。
而其他上過 TDD 課的同學 ,或是上過單元測試的同學,知道測試是用來描述情境,如果現在「加入的這個情境是新的需求或需求異動,代表目前 production code 還不支援這個情境,執行測試跑出的紅燈,就是等等 production code 要完成的 #目標」
test-frist 從來都只是 TDD 其中一個小小的衍生產物,而不是全貌。TDD, 測試驅動開發 從來都是一種開發方法,而不是測試方法。
總有些人老愛把 TDD 拿來跟測試相提並論,就總是喜歡把 test-first 當作靶子打,覺得違反人性跟直覺,覺得先寫測試在很多情況下是浪費時間或是不 work,可能拿來跟一堆測試的方法論相提並論,或總是只拿回歸測試的效益來當作 TDD 的整體。抑或是陷入 isolation unit test 與 integration test (其實就是非 isolation 等級、有實際依賴的自動測試)之爭。
```
註:TDD 事實上是可以不是單元測試等級的。
```
要比較正確看待 TDD 的角度,首先要知道它是幫助開發的、它是一種開發方式(當然不是唯一一種,甚至也不會是最好的一種,因為根本沒有最好,只有剛好)
接著要了解 TDD 可能用 IPO 模型還比較貼切,input-process-output,在你開發任何功能之前,你總要先想過這件事。而先想這件事,才是 TDD 的最基本精神。
接著是怎麼把你想好的東西,變成可執行的 spec,我們只是用測試程式來「描述」你腦袋中的「IPO模型」,把 process 的過程當作一個黑箱子。
而這個 IPO 模型在結合成「使用情境」,就會帶來「高易用性 API 的好處」,只有在一開始就先想好怎麼給別人用,最後才會好用。所謂的一開始想好,指的不是預先設計一堆 class,而是 input/output 想清楚期待(一般會結合實例化需求,搭配 Given/When/Then 的 gherkin style 來把前置條件、資料、前提想好,當發生什麼事,應該是怎樣的結果),然後描述它。在紅燈定義清楚目標,綠燈完成 input/output 關係且沒弄壞前面的所有情境後,來針對 process 進行重構(事實上 Kent Beck 的 TDD by Example 更多是用 refactor 來 #完成 process。
```
註:所謂的 output 不一定只有回傳值,包含外部依賴狀態、資料的改變,甚至顆粒度小一點,針對物件導向設計的話,物件內部狀態的改變也算,只是物件內部狀態改變,驗證點要嘛是拿得到內部狀態,要嘛就是要驗證物件哪個行為會因這個內部狀態而有所不同。
```
## 戰 TDD 之前該先做好的功課
要戰 TDD,是不是至少要把 Kent Beck 的 TDD by Example 看完?
要戰 TDD,請不要拿它跟測試方法論來比,那只是一下就被人看破手腳。因為它是個開發方法論。
要戰 TDD,請不要把它的好處只限縮在跟回歸測試、自動測試的比較,因為那只是它的衍生好處,當你試過在白海報紙上 TDD 就懂,TDD 是在釐清你的思緒的同時,又可以以終為始,確保你在 production code 的每一個動作都是為了滿足某個期待的情境。
要戰 TDD,請不要去把 單元測試、整合測試捲進來,那是測試的顆粒度,那是測試的分類,TDD 從來都不是只能限於單元測試。
要戰 TDD,請不要在那邊戰他是 bottom-up ,是直接從程式/class 的角度出發,事實上 TDD 既不是 bottom-up, 也不是 top-down, (書裡面就有講這件事咩),實務上的 TDD 結合倫敦派(GOOS)跟芝加哥派(Classic TDD),會更像 Outside-In 的進行方式,先定義好驗收情境,接著從最外部(也就是使用者看得到的部份)一路把依賴往另一邊的系統邊界推,直到推到系統以外的依賴資源(persistence 或 external API/service)
```
註: ATDD by Example 中 ATDD by Example, Kent Beck 寫的序最後的一段話。
Kent Beck:
「就像我曾說過的,TDD的一個缺點是,它可能會退化為一種用來滿足開發人員需求的編程技能。某些開發人員從更廣泛的角度來看待TDD,輕易在他們測試的不同抽象級別間跳躍。然而在ATDD中不存在歧義,這是一種加強與非編程人員溝通的技術。我們之間良好的協作關係,以及作為這種關係基礎的溝通,能夠使軟件開發更有效率。採用ATDD是向著溝通更清晰這個目標邁進的重要一步,而此書是一本全面又平易近人的入門讀物。」
```
要戰 TDD,請不要只關注在 test-frist,因為他只是用 test 來幫助你 think-first,不要邊寫邊想。然後不要過份依賴或相信你腦袋的能力,把你想好的東西具體化出來,最好可以被直接執行,最好除了你以外每個人執行出來的結果都會一樣(不管是對的,還是錯的)
要戰 TDD, 請不要把論點放在見樹不見林,如果你有看 TDD by Example 的 Part 1, Part 2 那兩個加起來共 24 個章節,就知道一開始就得把當下想到的全貌紀錄在一個「紙本」的 backlog (所謂的紙本,只是要講這並不依賴於任何工具)
而這個需求輪廓的全貌,會隨著你逐漸完成一部分一部分的情境,設計逐漸浮現後,而隨時跟著增減調整。
但不代表 TDD 就是先想到一個測試案例,就直接先幹下去了,那根本是亂搞。
以上這些,都還不是在列 TDD 的好處,而是針對那些從來沒搞懂 TDD 但又愛戰 TDD 的人一點提醒,你戰的很可能是「你誤解的 TDD」。
TDD 還有許多實務上的用途,列上我在譯者序中的一小段:
>> 測試驅動開發(Test-Driven Development, TDD)!一種以測試為開發輔助、以測試來描述需求情境、以測試來當作目標、以測試來表達期望、以測試來驗證疑問、以測試來實驗學習、以測試來溝通協作、以測試來協助設計高易用性 API 的「開發方法」。
譯者序有開放給大家看,請見:https://tdd.best/book/tdd-by-example/
拜託,要戰之前去看一下祖師爺 Kent Beck 對 TDD 的原始見解:https://www.tenlong.com.tw/products/9789864345618?list_name=srh
如果你想正確的使用 TDD 來幫助你在實務上產生許多的價值,帶來許多的好處,尤其是需求釐清、持續重構、小步快跑的部份,最好理解的培訓課就在這:https://tdd.best/courses/classic-tdd-by-example-video-training/
最後我想講一段話:
TDD 從來都不該被導入到團隊中,但它是一種很好的自我鍛鍊與學習的方式,也是一種能用很低的成本來帶來很多好處的開發方法(見下方註腳),然而它也不是適用所有的情況,但它可以讓『完美』變成一個動詞,而非不變的形容詞。
```
註:
Kent Beck 在 DHH 靠腰:《TDD is Dead》 之後寫的一篇反串文:《RIP TDD》
https://www.facebook.com/notes/1063422864115918/
我幾年前的簡易翻譯,通常也是 TDD 可以幫助你解決的問題,如下:
- Over-engineering (過度設計)
- API feedback (改善API的設計與可用性)
- Logic errors (想的跟寫的不一樣,寫的跟需求不一樣)
- Documentation (寫跟維護文件是痛苦的)
- Feeling overwhelmed (找不到切入點)
- Separate interface from implementation thinking (抽象設計)
- Agreement (確保已修正問題的證據)
- Anxiety (改東壞西的擔心受怕)
```
很久沒對 TDD 發表這種長篇大論了,因為不理解、不想理解、不同角度理解的人居多,能真的到各自的塔上用不同角度來看原義,以及實務上用它來幫助解決的問題有哪些的人,真的太少。
大部分人只想針對這個詞彙來攻訐以博得流量跟吸引目光,而不是想著「我可以用它來幫助我什麼」
問題跟需求是中性的,解決問題跟滿足需求的手段與方式有千萬種,不會只有一種,也不會有所謂的對錯,多點角度去了解不同的方法、方式,然後融會貫通,發揮綜效,在實務上用最少的成本與風險來產生最大的價值,這才是真正的目標。
導入敏捷不該是目標,導入 TDD 也不該是目標,目標永遠都是在實務上產生價值、解決問題、滿足需求。
同時也有176部Youtube影片,追蹤數超過3萬的網紅Pat Kay,也在其Youtube影片中提到,While there are so many ways to learn photography, there are also so many dead ends and potential rabbit holes you might waste your time on. In this ...
dead code 在 Facebook 的最佳解答
Current faves skincare! 🤩
When it comes to skincare regimen, I like to keep things simple and effective. Just like my workout! 😆I’ve been using the SKIN1004 Centella range for about two weeks and I’m loving it. What really won me over is that this skincare range is powered by Centella Asiatica that not only calm and soothe, but also hydrates the skin. It is especially ideal for those with sensitive skin like myself. The Centella Basic 4 range consist of :
Light Cleansing Oil - Formulated with Centella oil and 6 different types of plant oils, this all-in-one cleanser deeply cleanses and removes make up & impurities leaving skin cleansed with a moist finish. I’m amazed at how quickly the cleanser melt away my eye makeup!
Toning Toner - This exfoliating toner helps exfoliate dead skin cells gently and accelerate skin renewal to promote a brighter, radiant complexion. It is gentle enough for daily use.
Ampoule - Specifically formulated for sensitive skin, the ampoules contains only one main ingredient which is the Centella Asiatica extract. It provides deep hydration whilst calm and repair stressed skin. I love the lightweight, watery texture, it sinks into skin instantly leaving it soft and supple. If I have to pick a favourite from this range, it would be this!
Soothing Cream - The cream is brown in colour and has a lightweight consistency. Apart from Centella, it also contains 4 types of plant based ceramides which helps with soothing, hydrating and keeping the skin barrier healthy. It absorbs quickly and gives a nice cooling sensation.
Honestly, the @skin1004malaysia Centella range really works and I definitely saw results. Brighter, clearer complexion with visibly smaller pores, my skin feels smoother and more supple. Aside from that, I’m loving the minimalist packaging. 😍
Invest in a good skincare, your skin will thank you. If you’re interested to try these, use promo code ‘SKINCAP15’ for 15% off. 💥
Shop now - https://link.capssion.com/r/nNDGex
#elanabeauty
#skin1004 #skin1004my
#skin1004malaysia
#skin1004shopee #kbeauty
#kcosmetics #safeforsensitiveskin
#skincaretips #skincareaddict #skincarejunkie #skincarecommunity
dead code 在 IzaRamli Facebook 的精選貼文
Current fav combo! These two memang perfect for each other. Both very calming and soothing and not to forget very hydrating also. No wonder masa awal keluar dulu sangat hype Madagascar Centella series dari @skin1004malaysia ni.
Yang bestnya, both Madagascar Centella Toning Toner dengan Madagascar Centella Ampoule ni langsung tak melekit. Toner tu light je but can fell the fresh lepas apply dekat muka. At the same time toner tu boleh remove dead skin jugak. Ampoule tu memang best sebab memang sangat soothing plus jerawat Iza cepat betul heal.
Ingredients pun tak terlalu heavy and memang fokus dia pada soothing and healing. Very recommended to try and sensitive skin pun boleh try jugak.
Korang boleh beli dekat Shopee. Here the link and to get 15% off korang boleh guna code “SKINCAP15”:
https://link.capssion.com/r/LJaEES
@skin1004malaysia
#skin1004 #skin1004my #skin1004malaysia #skin1004shopee #kbeauty #kcosmetics #safeforsensitiveskin
dead code 在 Pat Kay Youtube 的最佳解答
While there are so many ways to learn photography, there are also so many dead ends and potential rabbit holes you might waste your time on.
In this video, I outline 20 essential photography tips for beginner photographers to help you get good quickly and give you the right fundamentals to work on.
Other videos mentioned in these tips:
The real secret to getting better at photography
https://www.youtube.com/watch?v=fzYHw47iHzg
How to find your style in photography
https://www.youtube.com/watch?v=lVWGCNedLIo
How to get sharp photos every time, with any camera
https://www.youtube.com/watch?v=Se1WzQLyldk
Transform your photography with these 4 simple, daily habits
https://www.youtube.com/watch?v=QMWbZC8SUX8
How to edit in Adobe Lightroom
https://www.youtube.com/watch?v=fnsoELHaFo4
———
Support me on Patreon or join this channel to get access to exclusive perks:
https://patreon.com/patkay
https://www.youtube.com/channel/UCeMvA8xJIGgvEjO0kgGFOpg/join
Let's chat! Join my Discord
https://discord.gg/UZr8GmZ75Q
Get the music I use
Epidemic Sound (30 days free) - https://geni.us/pk-epidemicsound
Artlist (get 2 months free) - https://geni.us/pk-artlist
Stock video footage (use my code for an extra 2 months free)
https://geni.us/pk-artgrid
———
🌐 Find me at
Patreon - https://patreon.com/patkay
Website - https://patkay.com
Instagram - https://instagram.com/pat_kay
Instagram (second account) - https://instagram.com/heypatkay
Twitter - https://twitter.com/heypatkay
Discord - https://discord.gg/nrm4ZdhRQQ
Twitch - https://twitch.tv/heypatkay
🛍 Shop
Photography Guide to Japan - https://geni.us/DiscoverJapan
Photography Guide to Tokyo - https://geni.us/TokyoGuide
My entire Adobe Lightroom preset pack - https://geni.us/presets
Prints - https://geni.us/pkprints
📷 Gear
Photo camera - https://geni.us/GJrG7iy
Video camera - https://geni.us/J1KUKOQ
Little camera - https://geni.us/TWPPdPC
Main lens - https://geni.us/ifAt80d
Wide lens - https://geni.us/6Gkq
Mid lens - https://geni.us/0ooL
Portrait lens - https://geni.us/mBf1I
Long lens - https://geni.us/213QPKM
Shotgun mic - https://geni.us/ogbq
Shotgun deadcat - https://geni.us/IGuRsBA
Lav mic - https://geni.us/z3i4Ov9
Drone - https://geni.us/2q5uu
Tripod - https://geni.us/vO4wh
Mini tripod - https://geni.us/k9ym
SD card - https://geni.us/DrVnd6q
Full gear list here - https://geni.us/A6HPT

dead code 在 Pat Kay Youtube 的最讚貼文
When talking about my story about how I transitioned to do what I do, I get a lot of questions asking me about how to quit your job and follow your passions, or create a life you love or become a full time creator.
Whether you're looking to quit your job and start a business, or you want to pursue your creative passions, or you're even just looking for a little more freedom in your life, this video details my approach to Lifestyle Design and how I made the transition from Product Designer, to being 100% in control of all aspects of my life.
I hope it helps and inspires you to make your own moves.
Support me on Patreon or join this channel to get access to exclusive perks:
https://patreon.com/patkay
https://www.youtube.com/channel/UCeMvA8xJIGgvEjO0kgGFOpg/join
Let's chat! Join my Discord
https://discord.gg/UZr8GmZ75Q
Get the music I use
Epidemic Sound (30 days free) - https://geni.us/pk-epidemicsound
Artlist (get 2 months free) - https://geni.us/pk-artlist
Stock video footage (use my code for an extra 2 months free)
https://geni.us/pk-artgrid
———
🌐 Find me at
Patreon - https://patreon.com/patkay
Website - https://patkay.com
Instagram - https://instagram.com/pat_kay
Instagram (second account) - https://instagram.com/heypatkay
Twitter - https://twitter.com/heypatkay
Discord - https://discord.gg/nrm4ZdhRQQ
Twitch - https://twitch.tv/heypatkay
🛍 Shop
Photography Guide to Japan - https://geni.us/DiscoverJapan
Photography Guide to Tokyo - https://geni.us/TokyoGuide
My entire Adobe Lightroom preset pack - https://geni.us/presets
Prints - https://geni.us/pkprints
📷 Gear
Photo camera - https://geni.us/GJrG7iy
Video camera - https://geni.us/J1KUKOQ
Little camera - https://geni.us/TWPPdPC
Main lens - https://geni.us/ifAt80d
Wide lens - https://geni.us/6Gkq
Mid lens - https://geni.us/0ooL
Portrait lens - https://geni.us/mBf1I
Long lens - https://geni.us/213QPKM
Shotgun mic - https://geni.us/ogbq
Shotgun deadcat - https://geni.us/IGuRsBA
Lav mic - https://geni.us/z3i4Ov9
Drone - https://geni.us/2q5uu
Tripod - https://geni.us/vO4wh
Mini tripod - https://geni.us/k9ym
SD card - https://geni.us/DrVnd6q
Full gear list here - https://geni.us/A6HPT

dead code 在 HAPPY ANJAY Youtube 的最讚貼文
[PRESS ME]
這個before的黑頭狀態我故意養了幾星期
才有這拍攝效果的!
(如果你平常沒有清黑頭可能跟我一樣?哈哈哈)
但一般1-2星期做一次就ok了
不要過度清潔喔!記得!要溫柔~~~
產品使用:
1️⃣CNP 黑頭粉刺mask 是1set 2張,我平時買1盒10 set的
在萬寧有賣 但比較貴,可以直接在官網買/ 像我找IG shop買的!
有些代購甚至比在韓國當地更便宜 不知道如何做到的 哈哈哈
2️⃣Dr. Wu 的 daily renewal essence with mandelic acid
我是當爽膚水在用,其他帶酸性能去油的都可以代替!
例如 etude house的藍色蘇打系列
3️⃣Kielh's 的金盞花爽膚水可能是不可取替的了哈哈哈
我實在太喜歡用 用了5年+
閒時敷下都可以收毛孔 記得要濕透那棉花!
4️⃣消炎的cream 任何牌子都ok吧!
類似平時消炎暗瘡膏等等
但Kielh's這支都是王牌
想買到都唔容易 我去了幾次都缺貨
太受歡迎了
ok 下次分享其他內容!byebyebyee
[ WATCH THESE TOOOO! ]
?HOME TOUR 月租$20,000銅鑼灣單位係點樣?香港同居生活~ | ANJAY ?
https://www.youtube.com/watch?v=H_GcAg1_c8w
?墨西哥VLOG 超震撼神光洞穴+粉紅湖 CANCUN DAY3 CENOTE 【中字】 | ANJAY ?
https://www.youtube.com/watch?v=U6YX0_TURPQ
?墨西哥VLOG 超級好玩的洞穴體驗 + 瑪雅遺址 + 食鱷魚肉!? CANCUN DAY 2! | ANJAY ?
https://www.youtube.com/watch?v=3oN7cgjlXCM&t=278s
?指甲矯形!MY NAILS ARE DEAD 我的指甲死了 媽啊。。。 | ANJAY ?
https://www.youtube.com/watch?v=mu2rGPsN76E&t=197s
?開箱減價ASOS 5天上班穿搭 BACK TO WORK LOOKBOOK 2020 | ANJAY ?
https://www.youtube.com/watch?v=h20Rn7ENeUA
——————————
【? BE MY INTERNET BEST FRIEND ! Find me on :】
✏︎ Instagram : @anjayho https://www.instagram.com/anjayho/
✏︎ Facebook: Anjay Ho https://www.facebook.com/anjayho
✏︎ Business contact : anjayho@gmail.com
——————————
【Discounts for MY INTERNET BEST FRIEND !】
1. AMIKA: 任何減價/正價產品5% off [code: ANJAYXAMIKA]
https://www.amika.com.hk/
——————————
Music by Goosetaf - Bumblebee - https://thmatc.co/?l=3380704B
Music by Fiji Blue - Home - https://thmatc.co/?l=88EB8629
