File CONTRIB.md changed (mode: 100644) (index fa7e0ea..eaab913) |
... |
... |
The indentation makes all the difference in the block environment. |
186 |
186 |
|
|
187 |
187 |
### Java |
### Java |
188 |
188 |
|
|
189 |
|
1. All the java code is beautified by the [google-java-format](https://github.com/google/google-java-format/) program shared in the `lib` subfolder (cf. the `clean_java` macro in the makefile). |
|
190 |
|
2. Every JAVA file name will be written as UpperCamelCase. |
|
191 |
|
3. Words are smashed together and the first letter of each word is capitalized. No word separator, like the underscore _, is used. |
|
|
189 |
|
#. All the java code is beautified by the [google-java-format](https://github.com/google/google-java-format/) program shared in the `lib` subfolder (cf. the `clean_java` macro in the makefile). |
|
190 |
|
#. Every JAVA file name will be written as UpperCamelCase. |
|
191 |
|
#. Words are smashed together and the first letter of each word is capitalized. No word separator, like the underscore _, is used. |
192 |
192 |
|
|
193 |
193 |
#### Example |
#### Example |
194 |
194 |
|
|
|
... |
... |
FileName.java |
197 |
197 |
|
|
198 |
198 |
``` |
``` |
199 |
199 |
|
|
200 |
|
4. If there is any version/number, it should be written as, |
|
|
200 |
|
#. If there is any version/number, it should be written as, |
201 |
201 |
|
|
202 |
202 |
```{.plain} |
```{.plain} |
203 |
|
FileName01.java, FileName02.java |
|
|
203 |
|
FileName0#. java, FileName0#. java |
204 |
204 |
``` |
``` |
205 |
205 |
|
|
206 |
206 |
#### Classes and Interfaces Names |
#### Classes and Interfaces Names |
207 |
|
1. Class and interface names are generally noun or noun phrases. |
|
208 |
|
2. Class and interface must begin with a capital letter. |
|
|
207 |
|
#. Class and interface names are generally noun or noun phrases. |
|
208 |
|
#. Class and interface must begin with a capital letter. |
209 |
209 |
|
|
210 |
210 |
#### Example |
#### Example |
211 |
211 |
|
|
|
... |
... |
class FishBowl implements AqueousHabitat { ... } |
216 |
216 |
|
|
217 |
217 |
#### Method Names |
#### Method Names |
218 |
218 |
|
|
219 |
|
1. Method names generally begin with a lowercase letter. |
|
220 |
|
2. A call on a procedure is a statement to do something, so a procedure name is generally a verb phrase that is a command to do something. |
|
|
219 |
|
#. Method names generally begin with a lowercase letter. |
|
220 |
|
#. A call on a procedure is a statement to do something, so a procedure name is generally a verb phrase that is a command to do something. |
221 |
221 |
|
|
222 |
222 |
#### Example |
#### Example |
223 |
223 |
|
|
|
... |
... |
class FishBowl implements AqueousHabitat { ... } |
225 |
225 |
public void setTitle(String t) { ... } |
public void setTitle(String t) { ... } |
226 |
226 |
``` |
``` |
227 |
227 |
|
|
228 |
|
3. A function call yields a value, so a function name is generally a noun phrase that describes the value. |
|
|
228 |
|
#. A function call yields a value, so a function name is generally a noun phrase that describes the value. |
229 |
229 |
|
|
230 |
230 |
#### Example |
#### Example |
231 |
231 |
|
|
|
... |
... |
public void setTitle(String t) { ... } |
233 |
233 |
public double areaOfTriangle(int b, int c, int d) { ... } |
public double areaOfTriangle(int b, int c, int d) { ... } |
234 |
234 |
``` |
``` |
235 |
235 |
|
|
236 |
|
4. The name of a boolean function is often a verb phrase starting with "is", thus describing what the value means, |
|
|
236 |
|
#. The name of a boolean function is often a verb phrase starting with "is", thus describing what the value means, |
237 |
237 |
|
|
238 |
238 |
#### Example |
#### Example |
239 |
239 |
|
|
|
... |
... |
public boolean isEquilateralTriangle(int b, int c, int d) { ... } |
242 |
242 |
``` |
``` |
243 |
243 |
|
|
244 |
244 |
#### Variable Names |
#### Variable Names |
245 |
|
1. Variable names generally start with a lowercase letter. |
|
246 |
|
2. Variable names should give the reader some hint about what the variable is used for. |
|
247 |
|
3. A well-chosen name, which gives a hint at the meaning of the variable, helps document a program, making it easier to understand. On the other hand, using the names of your friends or flowers that you like as variable names just annoys and makes the program harder to understand. Don't do that. |
|
248 |
|
4. Also, refrain from using vague names like counter or var or data; instead think about what the variable really is for and use a more concrete name. |
|
249 |
|
5. There is a tension between writing long descriptive names and very short names. |
|
250 |
|
6. We tend to use shorter names for parameters and local variables and longer names for fields and static variables. |
|
|
245 |
|
#. Variable names generally start with a lowercase letter. |
|
246 |
|
#. Variable names should give the reader some hint about what the variable is used for. |
|
247 |
|
#. A well-chosen name, which gives a hint at the meaning of the variable, helps document a program, making it easier to understand. On the other hand, using the names of your friends or flowers that you like as variable names just annoys and makes the program harder to understand. Don't do that. |
|
248 |
|
#. Also, refrain from using vague names like counter or var or data; instead think about what the variable really is for and use a more concrete name. |
|
249 |
|
#. There is a tension between writing long descriptive names and very short names. |
|
250 |
|
#. We tend to use shorter names for parameters and local variables and longer names for fields and static variables. |
251 |
251 |
|
|
252 |
252 |
#### Parameter Names |
#### Parameter Names |
253 |
|
1. Parameter names may be short, even one letter long. |
|
|
253 |
|
#. Parameter names may be short, even one letter long. |
254 |
254 |
|
|
255 |
255 |
#### Example |
#### Example |
256 |
256 |
|
|
|
... |
... |
public boolean isEquilateralTriangle(int b, int c, int d) {return b == c && c == |
259 |
259 |
``` |
``` |
260 |
260 |
|
|
261 |
261 |
#### Local variable names |
#### Local variable names |
262 |
|
1. A local variable is a variable that is declared in a method body. |
|
263 |
|
2. Its declaration should be placed as close to its first use as possible. |
|
264 |
|
3. The scope of a local variable is usually short, and its meaning is often obvious either from a comment on its declaration or from the short code in which it is used. Therefore, names of local variables may be short. |
|
|
262 |
|
#. A local variable is a variable that is declared in a method body. |
|
263 |
|
#. Its declaration should be placed as close to its first use as possible. |
|
264 |
|
#. The scope of a local variable is usually short, and its meaning is often obvious either from a comment on its declaration or from the short code in which it is used. Therefore, names of local variables may be short. |
265 |
265 |
|
|
266 |
266 |
#### Fields and class (i.e. static) variables |
#### Fields and class (i.e. static) variables |
267 |
|
1. The meaning of fields and class variables are typically given as comments by the declarations, far from where the variables are used. |
|
268 |
|
2. Therefore, the names of field and class variables should be longer and as mnemonic as possible, giving the reader a good idea what the meaning are. |
|
|
267 |
|
#. The meaning of fields and class variables are typically given as comments by the declarations, far from where the variables are used. |
|
268 |
|
#. Therefore, the names of field and class variables should be longer and as mnemonic as possible, giving the reader a good idea what the meaning are. |
269 |
269 |
|
|
270 |
270 |
#### Package names |
#### Package names |
271 |
|
1.Package names are usually all lowercase and consist of nouns. |
|
|
271 |
|
#. Package names are usually all lowercase and consist of nouns. |
272 |
272 |
|
|
273 |
273 |
|
|
274 |
274 |
#### Comment Style(s): |
#### Comment Style(s): |
|
... |
... |
public boolean isEquilateralTriangle(int b, int c, int d) {return b == c && c == |
297 |
297 |
* Use two spaces for each indent, conforming to the [guide in use](https://google.github.io/styleguide/javaguide.html#s4.2-block-indentation). |
* Use two spaces for each indent, conforming to the [guide in use](https://google.github.io/styleguide/javaguide.html#s4.2-block-indentation). |
298 |
298 |
|
|
299 |
299 |
### SQL |
### SQL |
300 |
|
* SQL folder has Homework Files. |
|
301 |
|
1. Every Homework will be followed by HW_ and filename. |
|
|
300 |
|
#. All the SQL code is beautified by the [pg_format](https://github.com/darold/pgFormatter) program (cf. the `clean_sql` macro in the makefile). |
|
301 |
|
#. All the SQL code is tested using the `code/sql/validate.sh` macro. |
|
302 |
|
#. Every file is named after the schema, and every schema starts with HW_. |
302 |
303 |
|
|
303 |
304 |
#### Example |
#### Example |
304 |
305 |
|
|
305 |
306 |
```{.plain} |
```{.plain} |
306 |
|
HW_HomeworkName.sql |
|
|
307 |
|
HW_SchemaName.sql |
307 |
308 |
``` |
``` |
308 |
309 |
|
|
309 |
310 |
#### Comment Style(s): |
#### Comment Style(s): |
|
... |
... |
HW_HomeworkName.sql |
322 |
323 |
``` |
``` |
323 |
324 |
|
|
324 |
325 |
#### Spacing: |
#### Spacing: |
325 |
|
* Use four spaces for each indent |
|
|
326 |
|
* Use two spaces for each indent |
326 |
327 |
|
|
327 |
328 |
|
|
328 |
329 |
### XML |
### XML |
329 |
330 |
|
|
330 |
331 |
* XML Files in Code Folder |
* XML Files in Code Folder |
331 |
|
1. Camel case is a common naming rule in JavaScripts. |
|
332 |
|
2. Uppercase first letter in each word except the first. |
|
|
332 |
|
#. Camel case is a common naming rule in JavaScripts. |
|
333 |
|
#. Uppercase first letter in each word except the first. |
333 |
334 |
#### Example |
#### Example |
334 |
335 |
> firstName.xml |
> firstName.xml |
335 |
336 |
|
|
|
... |
... |
HW_HomeworkName.sql |
354 |
355 |
W3C specifications says to define comments using ```/* ... */```{.css} whether single or multi-line because ```//```{.css} isn't supported on all browsers and can cause unexpected results. |
W3C specifications says to define comments using ```/* ... */```{.css} whether single or multi-line because ```//```{.css} isn't supported on all browsers and can cause unexpected results. |
355 |
356 |
|
|
356 |
357 |
#### Spacing: |
#### Spacing: |
357 |
|
1. Use four spaces for each indent |
|
358 |
|
2. Add one empty line between style definitions |
|
|
358 |
|
#. Use four spaces for each indent |
|
359 |
|
#. Add one empty line between style definitions |
359 |
360 |
Example: |
Example: |
360 |
361 |
|
|
361 |
362 |
```{.css} |
```{.css} |
|
... |
... |
Example: |
368 |
369 |
} |
} |
369 |
370 |
``` |
``` |
370 |
371 |
|
|
371 |
|
3. Add a space after colons between properties and values |
|
|
372 |
|
#. Add a space after colons between properties and values |
372 |
373 |
|
|
373 |
374 |
### Text |
### Text |
374 |
375 |
|
|
375 |
376 |
- Titles are capitalized using the Chicago Manual: |
- Titles are capitalized using the Chicago Manual: |
376 |
377 |
|
|
377 |
|
1. Capitalize the first and the last word. |
|
378 |
|
2. Capitalize nouns, pronouns, adjectives, verbs, adverbs, and subordinate conjunctions. |
|
379 |
|
3. Lowercase articles (a, an, the), coordinating conjunctions, and prepositions. |
|
380 |
|
4. Lowercase the ‘to’ in an infinitive (I want to play guitar). |
|
|
378 |
|
#. Capitalize the first and the last word. |
|
379 |
|
#. Capitalize nouns, pronouns, adjectives, verbs, adverbs, and subordinate conjunctions. |
|
380 |
|
#. Lowercase articles (a, an, the), coordinating conjunctions, and prepositions. |
|
381 |
|
#. Lowercase the ‘to’ in an infinitive (I want to play guitar). |
381 |
382 |
|
|
382 |
383 |
- Please, keep in mind that, as [@knuth1989mathematical, p. 19] writes: |
- Please, keep in mind that, as [@knuth1989mathematical, p. 19] writes: |
383 |
384 |
|
|
384 |
385 |
> Exercises are some of the most difficult parts of a book to write. Since an exercise has very little context, ambiguity can be especially deadly; a bit of carefully chosen redundancy can be especially important. |
> Exercises are some of the most difficult parts of a book to write. Since an exercise has very little context, ambiguity can be especially deadly; a bit of carefully chosen redundancy can be especially important. |
385 |
386 |
|
|
386 |
387 |
### File Name |
### File Name |
387 |
|
1. Make file names lowercase. |
|
388 |
|
2. Separate words with underscores. |
|
389 |
|
3. Use only standard ASCII alphanumeric characters in file and directory names. |
|
|
388 |
|
#. Make file names lowercase. |
|
389 |
|
#. Separate words with underscores. |
|
390 |
|
#. Use only standard ASCII alphanumeric characters in file and directory names. |
390 |
391 |
|
|
391 |
392 |
|
|
392 |
393 |
### Folder Name |
### Folder Name |
393 |
|
1. Folder Name should be meaningful. |
|
394 |
|
2. Make folder names lowercase. |
|
|
394 |
|
#. Folder Name should be meaningful. |
|
395 |
|
#. Make folder names lowercase. |
395 |
396 |
|
|
396 |
397 |
### Bibtex Entries |
### Bibtex Entries |
397 |
398 |
|
|
|
... |
... |
Entries are formatted using the on-line service <https://flamingtempura.github.i |
399 |
400 |
|
|
400 |
401 |
### Figure Name |
### Figure Name |
401 |
402 |
|
|
402 |
|
1. Figures Names should follow the Underscore Case. |
|
403 |
|
2. Everything is in lower case and the words are separated by underscores. |
|
404 |
|
3. This convention is also popularly known as snake case. |
|
|
403 |
|
#. Figures Names should follow the Underscore Case. |
|
404 |
|
#. Everything is in lower case and the words are separated by underscores. |
|
405 |
|
#. This convention is also popularly known as snake case. |
405 |
406 |
|
|
406 |
407 |
#### Example |
#### Example |
407 |
408 |
> figure_name.svg |
> figure_name.svg |