The Power ofVariable Names
• 今天要討論“變數名稱的力量”,這力量有可能是好的力
量,也可能是不好的力量。
• 接著會從幾個主題去讓我們的變數名稱都能發會出好的力
量。
3.
Agenda
1. Considerations inChoosing Good Names
2. Naming Specific Types of Data
3. The Power of Naming Conventions
4. Informal Naming Conventions
5. Standardized Prefixes
6. Creating Short Names That Are Readable
7. Kinds of Names to Avoid
The Most ImportantNaming Consideration
• 變數名稱最重要的是「可以完整而正確的描述」實際的意義
• 一個好的名字,在於反映"What is the problem",而不是"How the
solutions work”
• 一個變數要放員工資料,該取inputRec 或 employeeData ?
• 就運算或資料流程的觀點來看,是inputRec沒錯(How),但我們會不知道這實際是什
麼?(What)。