---
# System prepended metadata

title: Coding DOJO Requirement 1
tags: [CodingDojo, DDD]

---

# Coding DOJO Requirement 1

**Rules**
- Given a series of numbers between 1 ~ 100, replace certain numbers with a string
- Numbers divisible by 3 are replace by “Fizz”
- Numbers divisible by 5 are repalce by “Buzz”
- Numbers divisible by ( 3 and 5) are replaced by “FizzBuzz”
- All other numbers are unchanged

**規則**
- 提供數字 1~100, 並將其中某些數字取代成某個字串
- 被 3 整除的數字以 “Fizz” 取代
- 被 5 整除的數字以 “Buzz” 取代
- 被 3 及 5 整除的數字以 “FizzBuzz” 取代
- 其他的數字保持不變

**Example**
1 -> "1"
2 -> "2"
3 -> "Fizz"
6 -> "Fizz"
5 -> "Buzz"
10 -> "Buzz"
15 -> "FizzBuzz"
30 -> "FizzBuzz"


## TDD 流程
- 一個失敗的測試
- 最少可運行的程式碼
- 重構
    - Production Code
    - Testing Code
    - 消除重複
    - 語意化

![image alt](https://camo.githubusercontent.com/485f0442fb81bd0316ab6a34e42c231204bf4876ee7bfa8f0e02c5778ff0b0da/68747470733a2f2f65757578737761626c72766669687a7862666d6c2e73757061626173652e696e2f73746f726167652f76312f6f626a6563742f7075626c69632f6769746875622f556e6974253230746573742f7464642d7265642d677265656e2d7265666163746f72696e672d76332e706e67)
        
## Tips to test
- [Arrange Act Assert](https://automationpanda.com/2020/07/07/arrange-act-assert-a-pattern-for-writing-good-tests/)
- [Unit Test Naming Covention](https://medium.com/@stefanovskyi/unit-test-naming-conventions-dd9208eadbea)
- Naming - 讓名稱代表你的意圖
- 簡短的 function - 只做一件事
- DRY - Dont Repeat Yourself
- [用程式碼表達你的本意](https://www.google.com/search?q=%E7%94%A8%E7%A8%8B%E5%BC%8F%E7%A2%BC%E8%A1%A8%E9%81%94%E4%BD%A0%E7%9A%84%E6%9C%AC%E6%84%8F&oq=%E7%94%A8%E7%A8%8B%E5%BC%8F%E7%A2%BC%E8%A1%A8%E9%81%94%E4%BD%A0%E7%9A%84%E6%9C%AC%E6%84%8F&aqs=edge.0.69i59j0i546l2.556j0j1&sourceid=chrome&ie=UTF-8)
```java=
// Check to see if the employee is eligible for full benefits
if ((employee.flags & HOURLY_FLAG) && 
    (employee.age > 65)){
}
else {
    // Do Something
}
```

```java=
if (employee.isEligibleForFullBenefits()) {
    // Do Something
}
else {
    // Do Something
}

bool isEligibleForFullBenefits() {
    bool isApplyRetire = employee.flags & HOURLY_FLAG;
    bool isEligibleForRetire = employee.age > RETIRE_AGE_LIMIT;

    return isApplyRetire && isEligibleForRetire;
}
```




# Coding DOJO Requirement Change 1

數字有出現 “3” (如 13), 也需要輸出 “Fizz”
數字中有出現 “5” (如 52) 也要輸出 “Buzz”

13 -> Fizz
27 -> Fizz
52 -> Buzz
20 -> Buzz
35 -> FizzBuzz
53 -> FizzBuzz


# Coding DOJO Requirement Change 2

7 的倍數，以及 數字有出現 “7” (如 17), 也需要輸出 “Whizz”

7 -> Whizz
14 -> Whzz
17 -> Whizz
21 -> FizzWhizz
35 -> FizzBuzzWhizz


## Sprint 2

支援使用者定義，根據使用者的設定來取代數字
當是該數字的倍數要取代
公倍數時都要取代
出現某個數字時要取代 

Example:
```json
user configuration 
{ 
    4: “Gozz”,
    6: “Rozz”
}

Expect:
4: Gozz     6:Rozz 
8: Gozz   12: GozzRozz
```

Example 2:
```json
user configuration 
{ 
    3: “Fizz”,
    4: “Gozz”,
    5: “Buzz”,
    6: “Rozz”,
    7: “Whizz”,
}

Expect:
4: Gozz     6: FizzRozz 
8: Gozz    12: FizzGozzRozz
```




https://meet.google.com/jdv-bhwm-zci

wifi: 0266058128


### GOOGLE Drive
https://drive.google.com/drive/folders/1oKkmFyqqEw9DTrmB3Lz8vR8BMSC6NU9n

### 問卷
https://forms.gle/avx6YeeekNsx68kq9


###### tags: `DDD` `CodingDojo`
