'From Squeak2.7 of 5 January 2000 [latest update: #1762] on 28 October 2000 at 7:32:51 pm'! Object subclass: #Person instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'MakingSmalltalk-Article2'! !Person methodsFor: 'My Characteristics' stamp: 'JRS 10/28/2000 19:30'! whatIsMyHeight "Actually, in practice we'd probably just name this method 'height', with the 'whatIsMy' implied. Simple example to show how a query about my characteristic can be done. Height is hardcoded in string... A BAD PRACTICE TO DO, but is fine for example to keep things simple, and wanted to show how to do a ' in a string" (Workspace new contents: 'My height is 5'' 7"') openLabel: 'This is my height'! ! !Person methodsFor: 'Singing' stamp: 'JRS 10/28/2000 18:56'! maryHadALittleLambLyrics ^'Mary had a little lamb, little lamb, little lamb, Mary had a little lamb whose fleece was white as snow.' ! ! !Person methodsFor: 'Singing' stamp: 'JRS 10/28/2000 19:19'! mySing: someLyrics inManner: anAdjective withTitle: aTitle "Using simple logic here for illustrative purposes - if the adjective is not 'loudly' or 'quietly' just ignore how we're being asked to sing" | tmpLyrics | anAdjective = 'loudly' ifTrue: [tmpLyrics _ someLyrics asUppercase]. anAdjective = 'quietly' ifTrue: [tmpLyrics _ someLyrics asLowercase]. self mySing: tmpLyrics withTitle: aTitle ! ! !Person methodsFor: 'Singing' stamp: 'JRS 10/28/2000 19:12'! mySing: someLyrics withTitle: aTitle (Workspace new contents: someLyrics) openLabel: aTitle ! ! !Person methodsFor: 'Singing' stamp: 'JRS 10/28/2000 19:12'! sing self mySing: 'Do be do be doooooo.' withTitle: 'A bad impression of Sinatra' ! ! !Person methodsFor: 'Singing' stamp: 'JRS 10/28/2000 19:12'! sing: aSong aSong = 'MaryHadALittleLamb' ifTrue: [self mySing: self maryHadALittleLambLyrics withTitle: 'Mary had a little lamb'] ifFalse: [self sing]. ! ! !Person methodsFor: 'Singing' stamp: 'JRS 10/28/2000 19:17'! sing: aSong andDoIt: anAdjective aSong = 'MaryHadALittleLamb' ifTrue: [self mySing: self maryHadALittleLambLyrics inManner: anAdjective withTitle: 'Mary had a little lamb'] ifFalse: [self sing]. ! !