Stendhal code design: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>Titanium |
imported>MartinFuchs |
||
| Line 110: | Line 110: | ||
* We always use blocks in if-statements and loops, even if the block only consists of one single statement: |
* We always use blocks in if-statements and loops, even if the block only consists of one single statement: |
||
<code> |
|||
if (condition) { |
if (condition) { |
||
method(); |
method(); |
||
} |
} |
||
</code> |
|||
Avoid advanced Java Features like the following or explain their usage in inline comments. |
|||
* ternary operators, for example in: |
|||
<code>String y = x==null? "NULL": x.toString();</code> |
|||
* post-increment/decrement operators as in: |
|||
if (idx++ == 10) { |
|||
... |
|||
} |
|||
* comparing Strings by reference instead of using equals() |
|||