命名規范 camel case, pascal case, hyphen 等等


2020-08-02

hyphen vs en dash vs em dash 

hyphen 就是減, 用於把字連起來

比如 back-up

en dash 用於 x to y

比如 10:00AM – 11:00AM

em dash 很少用

目前看到的是 google ads 用來表示 empty value

 

 

 

 

 

常用 symbol

- hyphen
– en dash (alt + 0150)
— em dash (alt+ 0151)
° degree (alt + 0176)
² power 2 (alt 0178)
³ power 3 (alt 0179)
® trademark (alt 0174)

 

2020-07-13

Capitalization part 2.0

refer : 

https://uxplanet.org/why-letter-casing-is-important-to-consider-during-design-decisions-50402acd0a4e

花了多一點時間研究之后, 了解到了一些新的規則

uppercase

強項是突出,抓眼球,弱點就是不好讀 (尤其多字, 長的時候, 因為人習慣看小寫了)

如果想突出,想做層次,可以用. 

常用的地方是 tab, title, headline button  

一般用 css 做管理

 

title case 

強項是突出,抓眼球 (但是沒有輸給 uppercase) 字多的時候也是不容易閱讀

再強調一次 title case 並不是第一個字大寫, 有些時候是小寫的,比如: King of the Ring, "of" 和 "the" 是小寫

常用的地方 tab, title, headline button

 

sentence case

這個就普通用咯. 記得 proper noun 在句子里是大寫哦 (english grammer)

常用的放 

label, placeholder, error, hint

 

 

 

2020-07-07

Capitalization, title case, sentence case

英語里面有很多 rule 關於 capitalization 的, 就是第一個字要大寫.

refer :

https://developers.google.com/style/capitalization (google style guide)

https://designguidelines.withgoogle.com/conversation/style-guide/capitalization-punctuation.html (google style guide)

https://css-tricks.com/almanac/properties/t/text-transform/ (css text transform)

https://github.com/gouch/to-title-case/blob/master/to-title-case.js (title case js code)

https://www.herosmyth.com/article/headline-capitalization-ux-title-case-vs-sentence-case (title case vs sentence case)

https://grammar.yourdictionary.com/capitalization/rules-for-capitalization-in-titles.html (capitalization rule)

https://owl.purdue.edu/owl/general_writing/mechanics/help_with_capitals.html (capitalization rule)

 

很難學,規則太多了

記入一些就好了

1. title case 

在美國比較流行而已, 它的簡單邏輯就是這個詞,每一個字的第一個 character 要大寫. 然后連詞不要大寫

比如這個 : Top 7 Reasons Why a Blog is Essential for the Modern Business 

a, is, for the 都沒有大寫. 然后 Why, Blog 大寫

css 是無法實現 title case 的, 它只能做到每一個字第一個 character 大寫 但是不會處理 a, is, for, the 這些特色情況.

 

2. MLA style 指的是寫論文的格式. 不同國家其實還有更多的 style 哦...

 

3. sentence case 就是一般 english 寫句子的方式. 第一個字大寫, 然后 proper noun 專屬名詞大寫 

比如 : What can the Presidential Primary teach you about your brand?

Presidential Primary 就是 proper noun. 人名, product name 也是. iPhone 的話是 i 小寫哦,要尊重取名的人. 

 

在做項目的時候,系統用到的字 (title, label 等等)

我都是避開 title case, 只用 sentence case. 沒有 lowercase 和 uppercase 的. uppercase 就用 css 去調它.寫字的話都是 sentence case.

 

 

 

 

 

 

 

2020-02-17

trailing comma 和 trailing semicolons

for class 結尾只能是空或者 semicolons,逗號不行

class A { 
    age: number, // error
    name: string = 'dada'
    test: any;
}

for interface 都可以

interface A { 
    age: number,
    name: string,
    test: any; 
}

for enum 只可以放逗號

enum C { 
    age
    name = 'dada',
    test
}

所以我的規范是 

class 和 interface 放 semicolons 

enum 放逗號 

angular 也是這樣

 

 

2019-11-08 

refer : https://ux.stackexchange.com/questions/43174/update-vs-modify-vs-change-create-vs-add-delete-vs-remove

很多時候我們傻傻分不清 

create, add, new

-create 表示從沒有到有, 產生了新的東西

-add 通常是把某個東西添加進去某個東西,比如 add to cart, 通常產生的是一個關系,而不是一個具體的東西

-new 通常是 ui 用的

update, change, edit

-update 是修改內容, 產生新的值

-change 是替換,一個還一個

-edit 通常用於 ui

delete, remove

-remove 是移走, 消失的往往是關系. 

-delete 是刪除,真的把東西給消失掉了。

 

 

 

pascal case = PascalCase

camel case = camelCase

hyphen = blog-title

upper case = UPPERCASE

lower case = lower case

title case = Blog Title

 

backend c# 

class = pascal case

property = pascal case

enum key =  pascal case

variable = camelCase

parameter = camelCase

folder and file = pascal case

 

frontend js/ts

class = pascal case

property = camelCase

enum key =  pascal case

variable = camelCase

parameter = camelCase

folder and file = hyphen

 

url = hyphen and lowercase 

 

 

當命名遇上 short form

refer https://www.crownacademyenglish.com/types-english-abbreviations/

這篇詳細講解了縮寫.

縮寫有很多種,抽象都叫 abbreviation

每種縮寫都有幾個 point 

1. 怎樣取字

2. 怎樣發音

3. 要不要加符號 比如, dot (.) apostrophe (')

4. 大小寫

 

1. Initialism

取字: 多個 word, 每個 word 取第一個 character

發音 : 一個一個字母讀

加符號 : 每個字母中間可以加 dot, 美國尤其喜歡加 dot 

大小寫, 全大寫肯定可以, 如果原本字是小寫則可以全小寫. 但是不可以第一個字大寫后面小寫哦 Faq <-- 不好

as soon as possible = ASAP or asap

frequently asked questions = FAQ or faq

Federal Bureau of Investigation = FBI or F.B.I

 

2. Acronym

取字: 多個 word, 每個 word 取第一個 character

發音 : 幾個字母拼起來讀

加符號: 不可以加

大小寫, 全大寫肯定可以, 如果原本字是小寫則可以全小寫. 但是不可以第一個字大寫后面小寫哦 Faq <-- 不好

National Aeronautical and Space Administration = NASA

random access memory = RAM

zone improvement plan = ZIP

 

3. Shortenings (分 1, 2 兩種)

shortening 1 (treated as real words)

取字: 對一個 word, 去掉前面,后者去掉后面,或者去掉前后

發音 : 會有新讀音

加符號: 不可以加

大小寫, follow 原本的字

advertisement = ad

application = app

influenza = flu

 

shortening2 (not treated as real words)

取字: 對一個 word, 去掉前面,后者去掉后面,或者去掉前后

發音 : 讀回原本 full word 的音

加符號: 加 dot, 不加也是可以. prefer 加

大小寫, follow 原本的字

February = Feb.

et cetera = etc.

 

4. Contractions (分 2 個 type)

type 1: 

取字: 對一個 word, 去掉中間. (shortning 是去掉前后,這個是中間)

發音 : 讀回原本 full word 的音

加符號: 不可以加

大小寫, follow 原本的字

Doctor = Dr

government = govt

 

type 2: 

取字: 2 個 word, 中間去掉

發音 : 讀回原本 full word 的音

加符號: 加 apostrophe (') 撇號, pie hao

大小寫, follow 原本的字

he is = he's

they would = they'd

 

 

Shortening 就繼續小寫沒事兒.

acronym 就比較麻煩, 有時候全部大寫會很亂

有些人會把他變大小寫,有寫人不會...

我認為最好是保持大寫吧.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM