iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 30
1
影片教學

懶人寫寫 BOT系列 第 30

Day 30 Comments - Clean Code Ruby

嗨,我是 Fly,用 Ruby 寫 Chatbot 並挑戰30天分享心得
為確保不會沒靈感
每日含 Ruby 主題文章增加內容
https://github.com/leo424y/clean-code-ruby

Comments

沒用的 Code 就刪,git有存了

Bad:

do_stuff
# do_other_stuff
# do_some_more_stuff
# do_so_much_stuff

Good:

do_stuff

Git log

Bad:

# 2016-12-20: Removed monads, didn't understand them (RM)
# 2016-10-01: Improved using special monads (JP)
# 2016-02-03: Removed type-checking (LI)
# 2015-03-14: Added combine with type-checking (JR)
def combine(a, b)
  a + b
end

Good:

def combine(a, b)
  a + b
end

上一篇
Day 29 Formatting - Clean Code Ruby
系列文
懶人寫寫 BOT30

尚未有邦友留言

立即登入留言