# clean code 特點: 1. 能通過所有的測試。 2. 沒有重複的程式碼。 3. 充分表達系統設計個構思。 4. 具有最少數量的實體(entities),實體包含類別、方法(methods)、函式或其他欸似的實體等等。 ## 有意義的命名參數 example: bad (不知道參數意義) ``` def get_them(): list1 = [] for x in the_list: if x[0] == 4: list1.append(x) return list1 ``` good ``` def get_flagged_cells(): flagged_cells = [] for cell in gameBoard: if cell.is_flagged(): flagged_cells.append(cell) return flagged_cells ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up