Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • N naming-conventions
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Jira
    • Jira
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Kamolpop Kuadsantia (ไอซ์)
  • naming-conventions
  • Wiki
  • Home

Home · Changes

Page history
kamolpop created page: home authored Mar 14, 2016 by Kamolpop Kuadsantia (ไอซ์)'s avatar Kamolpop Kuadsantia (ไอซ์)
Show whitespace changes
Inline Side-by-side
home.markdown 0 → 100644
View page @ 2542934f
Naming conventions
=============
This library is the first step of a journey that every markup file in a repository goes on before it is rendered on GitHub.com:
0. This library converts the raw markup to HTML. See the list of [supported markup formats](#markups) below.
0. The HTML is sanitized, aggressively removing things that could harm you and your kin—such as `script` tags, inline-styles, and `class` or `id` attributes. See the [sanitization filter](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb) for the full whitelist.
0. Syntax highlighting is performed on code blocks. See [github/linguist](https://github.com/github/linguist#syntax-highlighting) for more information about syntax highlighting.
0. The HTML is passed through other filters in the [html-pipeline](https://github.com/jch/html-pipeline) that add special sauce, such as [emoji](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/emoji_filter.rb), [task lists](https://github.com/github/task_list/blob/master/lib/task_list/filter.rb), [named anchors](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb), [CDN caching for images](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/camo_filter.rb), and [autolinking](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/autolink_filter.rb).
0. The resulting HTML is rendered on GitHub.com.
Please see our [contributing guidelines](CONTRIBUTING.md) before reporting an issue.
File name
-------
#### 1. Use alpha and numeric characters only
> ใช้ตัวอักษร (A to Z, a to z) และตัวเลข (0 to 9) เท่านั้น
> การจำกัดเพาะตัวอักษรและตัวเลข จะทำให้ชื่อไฟล์ง่ายต่อการอ่านและจำ
#### 2. File names should be unique
> ชื่อไฟล์ที่เหมือนกัน อาจนำไปสู่การลบไฟล์โดยไม่ได้ตั้งใจ
#### 3. File names should be clear and concise
> ชื่อไฟล์ควรให้ข้อมูลเพียงพอที่จะอธิบายเนื้อหาในไฟล์ได้อย่างชัดเจน
>ใช้ชื่อไฟล์ที่สั้น แต่ยังต้องให้มีความหมายชัดเจน
>หากต้องการใช้คำย่อควรใช้ “คำย่อมาตรฐาน” เช่น
> “Rcvd” แทน “received”
> “Attch” แทน “attachment”.
#### 4. Demarcate words with Capital Letters
> การแยกคำด้วย capital letters แทนการใช้ underscores, hyphens จะทำให้หลีกเลี่ยงการใช้ชื่อไฟล์ที่ยาวเกินความจำเป็น
#### 5. Avoid repetition and redundancy
> ชื่อไฟล์ที่ซ้ำซ้อน ทำให้ชื่อไฟล์ยาวเกินความจำเป็น
> ไม่ควรใช้ “a”, “and’, “of”, “the”, “to” หากไม่จำเป็น
> ชื่อไฟล์ไม่จำเป็นต้องบอกประเภทของไฟล์ เช่น “Pdf”, “Presentation”, “Spreadsheet”.
> ชื่อไฟล์ไม่จำเป็นต้องมี ชื่อผู้สร้าง หรือวันที่สร้าง
> เช่น “NamingConventions” แทน “Pdf_records_management_guidance_on_
> naming_conventions_for_electronic_documents 6_June_2007_E_Longate”
#### 6. Gives dates back to front
> ยึดตามมาตรฐาน ISO 8601:2004
> YYYY Year
> YYYYMM Year and month
> YYYYMMDD Year, month and day
> hhmmss Hours, minutes and seconds
> เช่น “200708Invoices” แทน “August2007Invoices”
#### 7. Use two-digit numbers (unless a date or a number with more than two digits)
> การใช้ตัวเลขสองหลัก (ในกรณีใช้เลขไม่เกิน 99) จะทำให้ไฟล์มีการเรียงลำดับที่ถูกต้องแลพเป็นไปในทางเดียวกัน
> เช่น “NamingConventionsV01” แทน “NamingConventionsV1”
#### 8. Avoid using non-alphanumeric characters
> หลีกเลี่ยงการใช้อัครพิเศษ เช่น * : \ / < > | " ? [ ] ; = + & £ $ , .
Class name
-------
#### ชื่อ Class ต้องเป็นคำนาม ที่ครอบคลุมการทำงานของ Class เช่นถ้าเราจะสร้าง Class ของนกฮัมมิ่งเบิร์ดควรจะตั้งชื่อคลาสเป็นคำว่า
```
class HummingBird extends Bird
```
#### เมื่อเขียนชื่อ Class และเรียก function ต้องอ่านแล้วเข้าใจ เช่น
```
$HummingBird->fly();
```
Function name
-------
#### Function ที่ return boolean ให้ขึ้นต้นด้วย is, has เช่น
```
$HummingBird->isBird();
$HummingBird->hasWings();
```
#### Function ที่ return ค่า attribute ใน Class ให้ใช้ get นำหน้า เช่น
```
$HummingBird->getColor();
```
#### Function ที่ set ค่าให้ attribute ใน Class ให้ใช้ set นำหน้า เช่น
```
$HummingBird->setEyeColor();
```
#### ตัวแปร type boolean ต้องมี is หรือ has นำหน้า เช่น
```
$isActived = true;
```
#### ชื่อตัวแปรที่ไม่ใช่ boolean ต้องใช้คำนามที่ตรงกับหน้าที่ของตัวมันเอง เช่น
```
$eyeColor = “red”;
```
#### ห้ามใช้ตัวแปร flag เช่น
```
$flag = true;
```
#### ตัวแปรที่เป็นค่าคงที่ต้องเป็น UPPERCASE เช่น
```
$PI = 3.14;
```
#### ตัวแปรที่เอามาใช้วน Loop ต้องเป็น พหูพจน์ value ของแต่ละรอบต้องเป็น เอกพจน์ เช่น
```
foreach ($birds as $bird) {
...
}
```
#### Pick One Word per Concept ไม่ใช้คำหลายๆคำที่มีความหมายเดียวกันเช่นฟังก์ชั่นที่ใช้ดึงค่า ควรมีการตกลงกันว่าเป็นคำใดคำหนึ่ง fetch, retrieve, get
#### Reference
[Naming conventions for electronic document](https://www.st-andrews.ac.uk/media/business-improvements/recordsmanagement/documents/NamingConventionsV01.pdf)
\ No newline at end of file
Clone repository
  • Home