Skip to content

Commit 31eb206

Browse files
add class, function and interface naming convention
1 parent 97a36e6 commit 31eb206

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

docs/java/classes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ sidebar_label: Classes
55
---
66

77
#### The following convention should be followed for `class` naming:
8+
9+
* Class names are generally nouns, in title-case with the first letter of each separate word capitalized. e.g.
10+
- **LeaveController**
11+
- **EmployeeRepository**
12+
- **AttendanceRecord**
13+

docs/java/functions.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
---
22
id: functions
3-
title: Functions and Methods
3+
title: Functions
44
sidebar_label: Functions
55
---
66

7-
#### The following convention should be followed for `def` naming:
7+
#### The following convention should be followed for `function` naming:
8+
9+
* Method names should contain a verb, as they are used to make an object take action. They should be mixed case, beginning with a lowercase letter, and the first letter of each subsequent word should be capitalized. Adjectives and nouns may be included in method names:
10+
11+
### verb
12+
```
13+
public int calculateRemainingLeaves() {
14+
15+
//implementation
16+
17+
}
18+
```
19+
20+
### verb and noun
21+
22+
```
23+
public String getFullName() {
24+
25+
//implementation
26+
}
27+
````

docs/java/interfaces.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ sidebar_label: Interfaces
1010
* Generally, should be **adjectives** or **nouns**
1111
- *LeaveService*
1212
- *Approvable*
13+
14+
* Interface represents type or contract on what the public methods and properties have to support. While naming interface, make sure its implementating classes demonstrate a subset behavior.
15+
e.g
16+
- **HealthCheckService** interface can have implementing classes like **DBHealthCheckService** , **StorageHealthCheckService**, **NotificationHealthCheckService**
17+
- Try not to includes Prefix like **I** or suffix like **impl**

0 commit comments

Comments
 (0)