- Create complete objects
- Create valid objects
- Reify instance creation assertions
- Assertions category:
assertions
at: anIndex with: aName self assertIsValidIndex: anIndex. self assertIsValidName: aName. ^self new initializeAt: anIndex with: aName
- Avoid using
nil- Reify with a
null objector use amessage with an absent block
- Reify with a
- Favor immutable objects
- Use atomic updates for mutable objects when appropriate
- Error messages as class messages
- Category:
error description - Message name:
xxxxErrorDescription
- Category:
- Object naming:
- Reflect the role it fulfills within their naming context
- Avoid including the object type in the name unless it’s very generic
- Parameter names, for both messages and blocks, should start with
aoran
- Leave a blank line between method parameter definitions and the first collaboration
- Do not place a period (
.) at the end of the last collaboration - Group collaborations into cohesive sets
- Error handling:
[ ...
... ]
on: ...
do: ...-
Branching:
cond ifTrue: [ ... ]. cond ifTrue: [ ... ... ].
cond ifFalse: [ ... ] (Tratar de usar lógica positiva) cond ifFalse: [ ... ... ].
cond ifTrue: [ ... ] ifFalse: [ ... ] cond ifTrue: [ ... ... ] ifFalse: [ ... ... ]. -
Looping:
[ ... ] whileTrue: [ ... ... ]