Jaaved Ali Khan

18%
Flag icon
Adding a new method with a new selector to make code read more smoothly is a good use of the selector namespace. • Code a method on the parameter. Derive its name from the original message. Take the original receiver as a parameter to the new method. Implement the method by sending the original message to the original receiver. By defining Stream>>print:, we can smooth out the above method: Stream>>print: anObject           anObject printOn: self Point>>printOn: aStream           aStream                     print: x;                     nextPutAll: ‘ @ ‘;                     print: y
Smalltalk Best Practice Patterns
Rate this book
Clear rating
Open Preview