Suche senden
Hochladen
使用 switch/case 重構程式碼
•
17 gefällt mir
•
8,588 views
Weizhong Yang
Folgen
KKBOX 內部分享
Weniger lesen
Mehr lesen
Software
Melden
Teilen
Melden
Teilen
1 von 19
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
給 iOS 工程師的 Vue.js 開發
給 iOS 工程師的 Vue.js 開發
Weizhong Yang
Input Method Kit
Input Method Kit
Weizhong Yang
Afinal, o que são Single Page Applications
Afinal, o que são Single Page Applications
Patrick Monteiro
給 iOS 工程師的 Flutter 開發
給 iOS 工程師的 Flutter 開發
Weizhong Yang
Introdução ao ASP .NET Web API
Introdução ao ASP .NET Web API
Vinicius Mussak
How to select the right automated testing tool
How to select the right automated testing tool
Katalon Studio
REST API testing with SpecFlow
REST API testing with SpecFlow
Aiste Stikliute
Page Object in XCUITest
Page Object in XCUITest
Jz Chang
Empfohlen
給 iOS 工程師的 Vue.js 開發
給 iOS 工程師的 Vue.js 開發
Weizhong Yang
Input Method Kit
Input Method Kit
Weizhong Yang
Afinal, o que são Single Page Applications
Afinal, o que são Single Page Applications
Patrick Monteiro
給 iOS 工程師的 Flutter 開發
給 iOS 工程師的 Flutter 開發
Weizhong Yang
Introdução ao ASP .NET Web API
Introdução ao ASP .NET Web API
Vinicius Mussak
How to select the right automated testing tool
How to select the right automated testing tool
Katalon Studio
REST API testing with SpecFlow
REST API testing with SpecFlow
Aiste Stikliute
Page Object in XCUITest
Page Object in XCUITest
Jz Chang
Colorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latest
Onur Baskirt
Playwright: A New Test Automation Framework for the Modern Web
Playwright: A New Test Automation Framework for the Modern Web
Applitools
Nodejs Explained with Examples
Nodejs Explained with Examples
Gabriele Lana
用 Go 語言實戰 Push Notification 服務
用 Go 語言實戰 Push Notification 服務
Bo-Yi Wu
Pipeline based deployments on Jenkins
Pipeline based deployments on Jenkins
Knoldus Inc.
기본적인 테스트에 대한 pytest 자동화 접근
기본적인 테스트에 대한 pytest 자동화 접근
SangIn Choung
Ant, Maven and Jenkins
Ant, Maven and Jenkins
Kenu, GwangNam Heo
Introducing BDD and TDD with Cucumber
Introducing BDD and TDD with Cucumber
Knoldus Inc.
Robot Framework Introduction
Robot Framework Introduction
Pekka Klärck
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...
Edureka!
[Flutter] 來體驗 bloc 小方塊的神奇魔法 @Devfest 2022
[Flutter] 來體驗 bloc 小方塊的神奇魔法 @Devfest 2022
Johnny Sung
WebRTC 품질 측정 기초
WebRTC 품질 측정 기초
Blisson Choi
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Framework
valuebound
Cypress-vs-Playwright: Let the Code Speak
Cypress-vs-Playwright: Let the Code Speak
Applitools
Easy REST Integrations with Lightning Components and Salesforce1
Easy REST Integrations with Lightning Components and Salesforce1
Salesforce Developers
[COSCUP 2022] Kotlin Collection 遊樂園
[COSCUP 2022] Kotlin Collection 遊樂園
Shengyou Fan
Testing Services
Testing Services
QA Programmer
Automating deployments from GitHub using SaltStack
Automating deployments from GitHub using SaltStack
LINE Corporation
Selenium
Selenium
Adam Goucher
Angular and The Case for RxJS
Angular and The Case for RxJS
Sandi Barr
Flutter BLE
Flutter BLE
Weizhong Yang
怎樣在 Flutter app 中使用 Google Maps
怎樣在 Flutter app 中使用 Google Maps
Weizhong Yang
Weitere ähnliche Inhalte
Was ist angesagt?
Colorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latest
Onur Baskirt
Playwright: A New Test Automation Framework for the Modern Web
Playwright: A New Test Automation Framework for the Modern Web
Applitools
Nodejs Explained with Examples
Nodejs Explained with Examples
Gabriele Lana
用 Go 語言實戰 Push Notification 服務
用 Go 語言實戰 Push Notification 服務
Bo-Yi Wu
Pipeline based deployments on Jenkins
Pipeline based deployments on Jenkins
Knoldus Inc.
기본적인 테스트에 대한 pytest 자동화 접근
기본적인 테스트에 대한 pytest 자동화 접근
SangIn Choung
Ant, Maven and Jenkins
Ant, Maven and Jenkins
Kenu, GwangNam Heo
Introducing BDD and TDD with Cucumber
Introducing BDD and TDD with Cucumber
Knoldus Inc.
Robot Framework Introduction
Robot Framework Introduction
Pekka Klärck
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...
Edureka!
[Flutter] 來體驗 bloc 小方塊的神奇魔法 @Devfest 2022
[Flutter] 來體驗 bloc 小方塊的神奇魔法 @Devfest 2022
Johnny Sung
WebRTC 품질 측정 기초
WebRTC 품질 측정 기초
Blisson Choi
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Framework
valuebound
Cypress-vs-Playwright: Let the Code Speak
Cypress-vs-Playwright: Let the Code Speak
Applitools
Easy REST Integrations with Lightning Components and Salesforce1
Easy REST Integrations with Lightning Components and Salesforce1
Salesforce Developers
[COSCUP 2022] Kotlin Collection 遊樂園
[COSCUP 2022] Kotlin Collection 遊樂園
Shengyou Fan
Testing Services
Testing Services
QA Programmer
Automating deployments from GitHub using SaltStack
Automating deployments from GitHub using SaltStack
LINE Corporation
Selenium
Selenium
Adam Goucher
Angular and The Case for RxJS
Angular and The Case for RxJS
Sandi Barr
Was ist angesagt?
(20)
Colorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latest
Playwright: A New Test Automation Framework for the Modern Web
Playwright: A New Test Automation Framework for the Modern Web
Nodejs Explained with Examples
Nodejs Explained with Examples
用 Go 語言實戰 Push Notification 服務
用 Go 語言實戰 Push Notification 服務
Pipeline based deployments on Jenkins
Pipeline based deployments on Jenkins
기본적인 테스트에 대한 pytest 자동화 접근
기본적인 테스트에 대한 pytest 자동화 접근
Ant, Maven and Jenkins
Ant, Maven and Jenkins
Introducing BDD and TDD with Cucumber
Introducing BDD and TDD with Cucumber
Robot Framework Introduction
Robot Framework Introduction
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...
[Flutter] 來體驗 bloc 小方塊的神奇魔法 @Devfest 2022
[Flutter] 來體驗 bloc 小方塊的神奇魔法 @Devfest 2022
WebRTC 품질 측정 기초
WebRTC 품질 측정 기초
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Framework
Cypress-vs-Playwright: Let the Code Speak
Cypress-vs-Playwright: Let the Code Speak
Easy REST Integrations with Lightning Components and Salesforce1
Easy REST Integrations with Lightning Components and Salesforce1
[COSCUP 2022] Kotlin Collection 遊樂園
[COSCUP 2022] Kotlin Collection 遊樂園
Testing Services
Testing Services
Automating deployments from GitHub using SaltStack
Automating deployments from GitHub using SaltStack
Selenium
Selenium
Angular and The Case for RxJS
Angular and The Case for RxJS
Mehr von Weizhong Yang
Flutter BLE
Flutter BLE
Weizhong Yang
怎樣在 Flutter app 中使用 Google Maps
怎樣在 Flutter app 中使用 Google Maps
Weizhong Yang
關於延長役期這件事情
關於延長役期這件事情
Weizhong Yang
Dart null safety
Dart null safety
Weizhong Yang
導入 Flutter 前你應該知道的事
導入 Flutter 前你應該知道的事
Weizhong Yang
Github Actions
Github Actions
Weizhong Yang
iPlayground: CarPlay and MFI Hearing Aids
iPlayground: CarPlay and MFI Hearing Aids
Weizhong Yang
CocoaPods private repo
CocoaPods private repo
Weizhong Yang
Flutter 踩雷心得
Flutter 踩雷心得
Weizhong Yang
那些年被蘋果 Ban 掉的 API
那些年被蘋果 Ban 掉的 API
Weizhong Yang
苦集滅道:透過開發客製 Sketch Plug-in 改善產品設計流程
苦集滅道:透過開發客製 Sketch Plug-in 改善產品設計流程
Weizhong Yang
怎樣寫出比較沒有問題的 Code
怎樣寫出比較沒有問題的 Code
Weizhong Yang
貪食蛇
貪食蛇
Weizhong Yang
Aspect Oriented Programming
Aspect Oriented Programming
Weizhong Yang
Mac OS X 與 iOS 的 Audio API
Mac OS X 與 iOS 的 Audio API
Weizhong Yang
Html 5 native drag
Html 5 native drag
Weizhong Yang
Retina mac
Retina mac
Weizhong Yang
Python 的文件系統
Python 的文件系統
Weizhong Yang
Refactoring
Refactoring
Weizhong Yang
Core animation
Core animation
Weizhong Yang
Mehr von Weizhong Yang
(20)
Flutter BLE
Flutter BLE
怎樣在 Flutter app 中使用 Google Maps
怎樣在 Flutter app 中使用 Google Maps
關於延長役期這件事情
關於延長役期這件事情
Dart null safety
Dart null safety
導入 Flutter 前你應該知道的事
導入 Flutter 前你應該知道的事
Github Actions
Github Actions
iPlayground: CarPlay and MFI Hearing Aids
iPlayground: CarPlay and MFI Hearing Aids
CocoaPods private repo
CocoaPods private repo
Flutter 踩雷心得
Flutter 踩雷心得
那些年被蘋果 Ban 掉的 API
那些年被蘋果 Ban 掉的 API
苦集滅道:透過開發客製 Sketch Plug-in 改善產品設計流程
苦集滅道:透過開發客製 Sketch Plug-in 改善產品設計流程
怎樣寫出比較沒有問題的 Code
怎樣寫出比較沒有問題的 Code
貪食蛇
貪食蛇
Aspect Oriented Programming
Aspect Oriented Programming
Mac OS X 與 iOS 的 Audio API
Mac OS X 與 iOS 的 Audio API
Html 5 native drag
Html 5 native drag
Retina mac
Retina mac
Python 的文件系統
Python 的文件系統
Refactoring
Refactoring
Core animation
Core animation
使用 switch/case 重構程式碼
1.
Switch/Case Fika Time zonble
2.
很多時候你不該⽤用 Boolean,⽽而是 Enum
3.
你真的需要 這麼多 Boolean 嗎?
4.
其實你需要的是 Enum
5.
其實你需要的是 Enum • ⼀一起聽只有:未連線、台長、聽眾,三種狀狀態 •
⽤用三個 Bool 會變成八種狀狀態,但有五種狀狀態不可能出現 • 如果進入這五種狀狀態,就是 Bug
6.
⼀一個需要分段載入的畫⾯面 ⽤用了了多個 Bool 表⽰示「是否初次載入」、 「是否載入中」、「是否還需要改入更更多資料」…
7.
⼀一個需要分段載入的畫⾯面
8.
需求往往不是⼀一次提出來來的… • ⼀一開始沒做載入中動畫,為了了呈現載入進度,所以多⼀一個 Bool 判斷… •
⼀一開始沒做錯誤處理理,為了了呈現錯誤,所以多⼀一個 Bool 判 斷… • ⼀一開始沒做 Empty Set,所以多⼀一個 Bool 判斷… • 但,放任歷史的遺跡殘留留,就會讓程式碼失控
9.
UI Stack •Ideal State •Empty
State •Error State •Partial State •Loading State
10.
⼀一個需要分段載入的畫⾯面
11.
加上⼀一點 Swift 特性
12.
⼀一個需要分段載入的畫⾯面
13.
⼀一個需要分段載入的畫⾯面
14.
測試 case 也好寫了了 •
測試某些 Action 是否會讓畫⾯面進入某個 State • 測試某個 State 下 Layout 出來來的畫⾯面是否符合預期
15.
歌曲辨識 其實就是: Empty State Loading State Ideal
State Error State
16.
什什麼可以⽤用 Switch/Case 改寫?
17.
FizzBuzz
18.
根據不同時段給不同圖片
19.
Tuple
Jetzt herunterladen