Naming Conventions
Naming Convention
| สิ่งที่ต้องทำการ Naming | Guideline ในการตั้งชื่อ | ตัวอย่างการตั้งชื่อ | ตัวอย่างที่ไม่ถูกต้องตาม Guideline |
|---|---|---|---|
| Namespace | DIIS.ชื่อระบบ โดยให้ชื่อระบบเป็น Pascal Case |
DIIS.PSULoan | DIIS.psuLoan, HR.sis |
| Class (Data Model) | Pascal Case | LoanSystem | LOANsystem, loanSytstem |
| Class (อื่นๆ) / Razor Page / Blazor Component |
Pascal Case | LoanSystem | LOANsystem, loanSytstem |
| Interface Class | Pascal Case แต่ต้องขึ้นต้นด้วย I พิมพ์ใหญ่ |
ILoanItem | iLoanItem |
| Property ของ Class (Custom Field) |
1. Pascal Case และนำหน้าโดย _ 2. ต้องเป็นคำนาม |
_AverageGPA | averageGPA |
| Public Property ของ Class (อื่นๆ) | Pascal Case | StudentID, HrCode | STUDENT_ID, HR_CODE |
| Private Variable ของ Class | Camel Case | averageGPA | _averageGPA |
| Method ภายใน Class ที่เป็น Public / Protected | Pascal Case | ComputeGPA | computeGPA |
| Method ภายใน Class ที่เป็น Private | Camel Case | computeGPA | ComputeGPA |
| Method กลุ่ม Create | Insert ตามด้วยชื่อข้อมูล | InsertScore | NewScore,AddScore |
| Method กลุ่ม Read | Get ตามด้วยชื่อข้อมูล | GetStudentProfile | ListStudentProfile |
| Method กลุ่ม Update | Update ตามด้วยชื่อข้อมูล | UpdateProfile | profileUpdate |
| Method กลุ่ม Delete | Delete ตามด้วยชื่อข้อมูล | DeleteScore | RemoveScore,ScoreDelete |
| Method arguments | Camel Case | GetStudentProfile(string studentID) | GetStudentProfile(string StudentID) |
| ตัวแปร Local ที่ใช้เฉพาะภายใน Method ใดๆ | Camel Case * ไม่ตั้งชื่อตัวแปรเป็นอักษรเดียว เว้นแต่เป็นตัวแปรกลุ่มวนลูป หรือ ควบคุม Iterator ที่ใช้ภายในสโคปสั้นๆ |
||
| ตัวแปร Static หรือ ค่าคงที่ | ให้ตั้งชื่อด้วยตัวพิมพ์ใหญ่ทั้งหมด ระหว่างคำให้คั่นด้วย _ | IMG_PATH | imgPath, ImgPath |
| ชื่อไฟล์เอกสาร Text ที่ไม่เกี่ยวข้องกับ Project แต่ใช้อธิบายโปรเจค (เช่น ReadMe) | ให้ตั้งชื่อเป็นตัวอักษรพิมพ์ใหญ่ทั้งหมดเท่านั้น และไม่ต้องระบุสกุล .txt | README,LICENSE | Readme.txt |
* กรณีเป็นตัวย่อ ให้ใช้ตัวพิมพ์ใหญ่ทั้งหมดได้ เช่น DIIS, ID, GPA,