CSS

[Style Guide]Google Javascript Style Guide的結語

BE CONSISTENT.

If you're editing code, take a few minutes to look at the code around you and determine its style. If they use spaces around all their arithmetic operators, you should too. If their comments have little boxes of hash marks around them, make your comments have little boxes of hash marks around them too.

"如果妳在修改程式碼, 花幾分鐘看一下其他程式碼並了解它的風格.
如果他們在算數運算子周圍用了空格,妳也該用,如果他們用橫線圍住註解,妳也該用橫線圍注你的注解"

The point of having style guidelines is to have a common vocabulary of coding so people can concentrate on what you're saying rather than on how you're saying it. We present global style rules here so people know the vocabulary, but local style is also important. If code you add to a file looks drastically different from the existing code around it, it throws readers out of their rhythm when they go to read it. Avoid this.

"這個guideline的重點是提供一份共同的字彙庫,讓每個人能專注在妳說什麼而不是妳怎麼說的.我們提出了一份共通的style規則讓大家能了解程式碼的規則,但是小部分的風格也很重要,如果妳的程式碼和周圍的檔案看起來完全不同,這會讓看的人失去了他們閱讀程式碼的節奏感,要盡量避免"

No comments:

Post a Comment