看板 Soft_Job 關於我們 聯絡資訊
※ 引述《bf000777966 (joe)》之銘言: : 有些人以為邏輯程度好就不需要註解,但是語文能力(英文?)跟邏輯是一樣重要的,精準 : 的命名也是需要一定的底子,如果連命名別人都看不懂還是多寫點註解還能順便增強語文能 : 力。 雖說前面打哈哈已經回了一篇 老實說我比較意外好像有人把clean code當聖經一樣推廣 寫註解這件事 我自己的態度是 https://i.imgur.com/InnN0Wm.jpg
我不會期待其他人寫code的能力有多高竿 同樣一段邏輯就算用中文講對方都不一定聽的懂的 就算使用表達能力強的現代程式語言都不見得能省多少解讀時間 拿我最近在hack的project來說 def reset_state_for_orphaned_tasks(self, filter_by_dag_run=None, session=None): """ This function checks if there are any tasks in the dagrun (or all) that have a scheduled state but are not known by the executor. If it finds those it will reset the state to None so they will get picked up again. The batch option is for performance reasons as the queries are made in sequence. :param filter_by_dag_run: the dag_run we want to process, None if all :type filter_by_dag_run: models.DagRun :return: the TIs reset (in expired SQLAlchemy state) :rtype: List(TaskInstance) """ 我會很喜歡讀這種代碼 一個function,使用在什麼情境 期待的input長什麼樣子等等 就像在看一個故事 我相信不少人都有看過類似程式碼是藝術這種標語 但是醒醒吧 你的藝術 曲高和寡 https://i.imgur.com/tEv4vxy.jpg
-- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.33.14.27 ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1546162309.A.01A.html ※ 編輯: del680202 (60.33.14.27), 12/30/2018 17:36:34
cuteSquirrel: 推薦這篇文章和意境 12/30 17:36
pttworld: 工程師的英文都不用太期待 12/30 17:38
superpandal: 其實clean code是用來區分你跟他是不是同類的標準 12/30 21:12
babelism: 這只是類javadoc的API reference,和comment不同 12/30 22:33