-
Notifications
You must be signed in to change notification settings - Fork 0
Coding Guidelines
In this repository, we employ the following coding guidelines and would encourage all contributors to follow them:
One statement per line, the statement may be multi-line.
Name parameters in squeak-style: aParameter, anInteger, etc.
One space before an opening bracket and after a closing bracket: ifTrue: [foo]
Space around @: (69 @ 420)
Space after return character ^
Temporary variable definitions are padded with space: | tempVar1 tempVar2 |
General form:
collection do: [ :i | | temp var |
...
].
Blocks containing only one statement may be truncated to a single line.
One message per line:
foo new
withMessage: aMessage;
withColor: aColor;
yourself.
Messages are always ended with a period.
One message per line, if there are multiple arguments, the message may be expanded to multiple lines.
ifTrue/ifFalse moves to next line and is indented:
(condition)
ifTrue: [foo]
ifFalse: [bar]
Always use getters and setters to access variables, even when accessing a variable within the class.
Tests may access their instance variables directly.
Common method categories to be used across classes.
-
initialization: methods responsible for creating a new instance of a class -
accessing: methods responsible for getting/setting instance variables