個人部落格作業-Week2 (代碼規範, 代碼複審)

來源:互聯網
上載者:User

標籤:

代碼規範:

1.這些規範都是官僚制度下產生的浪費大家的編程時間、影響人們開發效率, 浪費時間的東西。

 編碼規範它包含了代碼格式,還包括了編碼風格和其他規範,通常涉及:縮排、空格使用、Tab使用

   注釋、命題習慣、程式碼長度和語言特點風格,從而使大家能夠很方便得互相閱讀對方的代碼從而促進

   團隊中的溝通與交流。不是浪費時間。

2.我是個藝術家,手藝人,我有自己的規範和原則。

  藝術家的表現層次如果只是在規範上面,顯然不是個優秀的藝術家,通過大家都容易接受的方式可以

     讓自己的創造力更好得表現出來。

3.規範不能強求一律,應該允許很多例外。

  我覺得只要不是什麼太苛刻得規範,還是盡量做到一律吧,起碼別人看起來不會產生情緒。

4.我擅長制定編碼規範,你們聽我的就好了。

  要結合大家的特點,不能僅僅是依靠個人的習慣。

代碼複審:

這是我給結對組同學的代碼複審表。

General

Does the code work? Does it perform its intended function, the logic is correct etc.

 程式能正常運行,各個功能都完整。

Is all the code easily understood?

 代碼結構清晰,好好兒解釋代碼。

Does it conform to your agreed coding conventions? These will usually cover location of braces, variable and function names, line length, indentations, formatting, and comments.

看來他的代碼跟厲害,看他的代碼學的很多了。

Is there any redundant or duplicate code?

Generate和Compute函數的功能很多了,這兩個函數可以在模組化一些。

Is the code as modular as possible?

 沒有劃分模組

Can any global variables be replaced?

全域變數比較合適

Is there any commented out code?

代碼都比較乾淨找不到刪除的地方

Do loops have a set length and correct termination conditions?

正常結束

Can any of the code be replaced with library functions?

可以用到庫函數

Can any logging or debugging code be removed?

 沒有的

Security

Are all data inputs checked (for the correct type, length, format, and range) and encoded?

都做到了

Where third-party utilities are used, are returning errors being caught?

 未使用

Are output values checked and encoded?

 都正確

Are invalid parameter values handled?

 輸入錯的話不進行,並結束程式

Documentation

Do comments exist and describe the intent of the code?

 沒有寫文檔

Are all functions commented?

 沒有寫文檔

Is any unusual behavior or edge-case handling described?

 沒有寫文檔

Is the use and function of third-party libraries documented?

 沒有寫文檔

Are data structures and units of measurement explained?

 沒有寫文檔

Is there any incomplete code? If so, should it be removed or flagged with a suitable marker like ‘TODO’?

 沒有寫文檔

Testing

Is the code testable? i.e. don’t add too many or hide dependencies, unable to initialize objects, test frameworks can use methods etc.

 代碼可以測試

Do tests exist and are they comprehensive? i.e. has at least your agreed on code coverage.

 沒有設計測試代碼

Do unit tests actually test that the code is performing the intended functionality?

 沒有設計測試代碼

Are arrays checked for ‘out-of-bound’ errors?

 沒有進行數組越界檢查

Could any test code be replaced with the use of an existing API?

 沒有設計測試代碼

個人部落格作業-Week2 (代碼規範, 代碼複審)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.