Naming Convention 命名規則
- 2023.08.15
- Programming Techniques / Tools
- NamingConvention
Naming Convention1WIKIPEDIA: Naming Convention (Programming)
Python
Class and Function/Method (UpperCamelCase)
Constant (CAPITALIZED_WITH_UNDERSCORES)
Others (lowercase_separated_by_underscores)
Underscore
Before a Name (name_)
Avoid Keyword Conflicts
After a Name (_name)
Private Members
Internal Use
Folders(UpperCamelCase) and Files(lowercase_separated_by_underscores)
好處是「可用名稱首字母大小寫辨認是資料夾或檔案」
How to Use Underscore(_) and Hyphen(-) in Google Style Filenames
Use hyphens, not underscores, to separate words—for example, query-data.html. Search engines interpret hyphens in file and directory names as spaces between words. Underscores are generally not recognized, meaning that their presence can negatively affect SEO.2Google Developer Documentation Style Guide: Filenames and File Types
搜尋引擎通常會將檔案或資料夾名稱中的連字號 (Hyphen, “-“) 理解為詞與詞之間的空格
而底線 (Underscore,”_”) 通常不會被辨識,比較不會影響到 SEO 的處理
⇒ 因此建議使用連字號 (Hyphen, “-“) 而不是底線 (Underscore,”_”) 用以作為詞彙間的間隔
Last Updated on 2025/01/07 by A1go