Skip to content

Commit 24db415

Browse files
committed
docs: add java method conventions to README.md
1 parent 905c942 commit 24db415

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,27 @@ The following are lists of conventions that either *should* be followed or *must
8888
- Names must be `SCREAMING_SNAKE_CASE`
8989
- Instance Attributes and Method Parameters:
9090
- Names must be `camelCase`
91-
- Should be `final` unless there is a reason to change
91+
- Should be `final` unless there is a reason to change
92+
- Methods:
93+
- Names must be `camelCase`
94+
- Should be at most around **15** lines long
95+
- Should reference down to other `private` methods unless there is a specific reason not to (top-down structure)
96+
- Indentations should not be more than 3 levels deep (counting method indentation level in class as zero)
97+
```java
98+
public class Foo {
99+
// This is level 0.
100+
public void bar() {
101+
// This is level 1.
102+
for (int i = 0; i < 10; i++) {
103+
// This is level 2.
104+
for (int j = 0; j < 10; j++) {
105+
// This is level 3.
106+
if ((i + j) % 2 == 0) {
107+
// This is level 4 (forbidden).
108+
break;
109+
}
110+
}
111+
}
112+
}
113+
}
114+
```

0 commit comments

Comments
 (0)