CS Chapter 2 Flashcards
(9 cards)
Whitespace guidelines
Sub-statements are indented 3 spaces from parent statement;
Most items separated by no more than and no less than 1 space (no space before ;)
Braces
guidelines
For branches, loops, methods, or classes, opening brace appears at the end of the item’s line. Closing brace appears under item’s start
Braces always used even if only sub-statement
Naming guidelines for variables
always start with lowercase (camelCase); be descriptive and use at least two words; avoid abbreviations
Naming guidelines for constants
upper case and underscores (MAXIMUM_WEIGHT)
Naming guidelines for methods
camelCase with lowercase first
How long should a line of code be MAX
<100 characters
identifier
name created by a programmer for an item like a variable or method
reserved word/keyword
word that is part of the language, like int, short, double.
integer literal
numeric value without decimal point or exponent or anything