GithubHelp home page GithubHelp logo

squarebracketassociates / newpharobyexample9 Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 8.0 75.59 MB

The PharoByExample9 repository since to have a broken history. Now the book versioning is moved to this repository to get work done.

HTML 21.08% CSS 36.74% JavaScript 14.57% TeX 22.47% Shell 2.32% Perl 0.17% Mustache 2.66%

newpharobyexample9's People

Contributors

andrzejp avatar bpieber avatar ducasse avatar kholbekj avatar marcusdenker avatar rvillemeur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

newpharobyexample9's Issues

Chapter 16

p. 229

  • "A simple example of this is that you can detach a menu item and keep it as a button." In fact, we CAN'T detach a menu item in Pharo 9.0 - only duplicate it.
  • "Bring up the World Menu and Option-Command-Shift click once on it..." - What does it mean? Would be better to said about "meta-click" - see subsection 3.2 Interacting with Pharo
  • "... click once on it to bring up its morphic halo, then repeat the operation again on a menu item ..." the whole story is about to be wrong: I don't need to click twice. Just clicking on the menu item opens it's halo.
  • "Once dropped the menu item stays detached from the menu..." menu item stays IN the menu and its COPY stays on the screen.

p. 231

  • Listing 16-3 jump away from its place.
  • Error: "Now execute (Morph new colors: Color orange) openInWorld" - an instance of Morph does not understand colors: - should be color: Thus, the last sentence should be removed "You get the same executing..."

p. 239 "to make the halo appear and grab either the brown move handle or the black pickup handle at the top of the morph" the brown move handle is ungrabable :(

p.240

  • "handleKeystroke:" Is the method's name handleKeystroke: from the previous version? Should be replaced by keyDown:?
  • "To start things off, you can open an inspector on a CrossMorph..." From my observations, the stepping is turned on automatically as soon as the method step is declared. Is it normal? Even "self stopStepping" in the CrossMorph>>initialize does not stop stepping. A kind of black magic...

p. 243 "Let’s create a specific subclass of Morph, named DroppedMorph, so we can experiment a bit more. Let us define a new kind of morph called DroppedMorph." Two times the same idea.

p. 246 "((aNumber isInteger and: [ aNumber > 0 ]) and: [ aNumber <= 9 ])" should be "(aNumber isInteger and: [ aNumber > 0 and: [ aNumber <= 9 ] ])" according to Pharo recommendation.

Chapter 17

p. 255 Error: "Rule 7 says that the superclass of a metaclass cannot be an arbitrary class..." Should be "Rule 8"

p. 260 typo: "and querying (i.e., hasMethods, includesSelector," should be includesSelector:

p. 262 Convention "Object class superclass --> ProtoObject class" should be "Object class superclass >>> ProtoObject class"

p. 263 Question - I don't understand the statment "Every class is a Class." I now, that SortedCollection is a Collection, Float is a Number and so on. The relation "is-a" means: something concrete is a kind of something more general. So "Every class is an Object", and "Every metaclass is a Class". Is this true or not?

First exercise relies on concepts not yet introduced

Going through the book, the first exercise:

The setter method does not currently exist, so as an exercise create the method ==count:== such that, when invoked on an
instance of ==Counter==, the instance variable is set to the argument of the message. Test your method by evaluating the
example above in a Playground.

Was not solvable for me without google (which lead to a smalltalk thread of someone else asking the same question).

  • The fact that we can pass arguments to methods in definitions (count: someValue)
  • The fact that we can assign to our own instance variables by simple name (count := someValue)

are both new concepts at this point that haven't been described, so the exercise doesn't really test our knowledge, but rather forces us to look for another resource to learn the syntax.

I'm happy to update it, but was wondering if you prefer:

  • an explanation of these possibilities
  • or a solution after the fact
  • or something else?

Chapter 9

p. 106 "A receiver can be the first element of a message" - contradicts to the terminology, because "A message is composed of a message selector and optional message arguments". So it should be "A receiver can be the first element of an expression" (or message sent).

p. 107

The same situation: "For example in the message Pen new go: 100": the messages are "new" and "go: 100" but "Pen new go: 100" is an expression.
The table: "100 pixels" jumped from third column to second one
The table: "100 is increased by 20" is it true? The object 100 will be modified or the new object 120 will be created?
p. 108 "Unary messages ... not containing a colon ():)" - the first rigth parenthese is needless.

p. 111

Wrong result in the example "[:aClass | aClass methodDict keys select: [:aMethod | (aClass>>aMethod) isAbstract ]] value: Boolean". It returns an Array, not an IdentitySet. Should be ">>> #(#ifTrue: #| #xor: #asBit #ifFalse:ifTrue: #ifFalse: #ifTrue:ifFalse: #or: #& #and: #not)"
some strange situation: several times in the book were written "Class>>methodName isn't a syntax, this is only a way to note..." but now we saw in the example (aClass>>aMethod) - !?!?
Decomposing the execution of aPen color: Color yellow in the last example - should it be double quoted as a comment?
p. 112 The reference to Figure 9-4 is missing

p. 113 Bad formatting of the last example. Should "Example of Parentheses." be a comment?

p. 115

There are not references to Figures 9-7, 9-8.
A strange situation: Decomposing 20 + (2 * 5) has the title an 20+2*5 has not. How about a common style of examples?
p. 116

Figure 9-10: the receiver Bot new is not underlined
Figures 9-9, 9-10 are very nice but there are not references to it.
The table: "aPen go: 100 + 20=" = should be deleted
p. 117 Bad formatting of the last example.

p. 118

"aReceiverExpression msg1 ; msg2 ; msg3" need we spaces before semicolons?
"the first cascaded message is setX:setY since it is followed by a cascade" - "followed by a semicolon" would be better. Or not?
p. 119

"Unary messages are messages that do not require any argument. They are of the form: selector." - according to the next items of the list it should be "... They are of the form: receiver selector.", selector - bold
"Binary messages are messages that involve two objects, the receiver and another object" - another object OR an argument?
"receiver selectorKeywordOne: argumentOne KeywordTwo: argu�mentTwo ... KeywordN: argumentN" - KeywordTwo:, KeywordN should start with lowercase.

No mention of Fluid nor Slots

While not so common yet the transition of the class creation template in Calypso to the Fluid style with Slots is not described anywhere. Also, the class creation in figure 6-4 shows the old style with the slots check box instead of the Fluid check box although the Fluid check box is implemented in both Pharo 9 and 10. While this may seem insignificant to a new learner, it did later catch me in the Building Applications with Spec2 book where the Fluid style is shown in some places and the non-fluid style in others.

Green or blue

Chapter 6, the ending of subsection 6.6 p. 61: "Notice that there is a little green arrow next to your method" but really the arrow is light blue :)

how to create epub foramt?

If you create a epub format book ,I can translate the book in Chinese by ChatGPT, Thank you very much

Chapter 18

p. 266-267 Errors: "self bounds: (Rectangle origin: 10@10 corner: 300@300)" >>> Instance of SpWindowPresenter did not understand #bounds. Should be "self adapter widget bounds: (Rectangle origin: 30@30 corner: 300@300)". "...as shown in Figure 18-2" - but the Figure shows the next code snipet with reflective access.

p. 267 Questions:

  • "For instance, you can change the value of the w binding of the first workspace by evaluating:" - What is "w"? Is it from the previous subsection? "by evaluating" where? In the inspector from the previous subsection? In the first Playground? This isn't obvious.
  • "Click on it to raise a refresh and see the result." - Who is "it"? The second Playground?

p. 268 Question: "The following code snippet shows how to display the values..." - but it shows how to collect Associations{varName->value}, i.e how to build a Dictionary - this is more than simple "to display"

p. 270 Question: "the receiver has a method whose selector..." - what does it mean in fact? There is a method defined in own class, or we talk about own or inherited one? I would like to say "the receiver understands the message"

p. 273 Error: "Point allCallsOn returns all messages sent explicitly to Point as a receiver." It returns not "messages sent to Point" (i.e. methods of Point), but "selectors of methods of different classes wich have sending to Point in their bodies".

p. 274 Figure 18-4 is outdated. Today inspector on a dictionary inspects values not associations, so we have not the third column.

p. 277 A complete disappointment: the code snippets do not work! The first one "((RBBrowserEnvironment new forClasses: (Collection withAllSubclasses)) selectMethods: [:method | method sendsToSuper]) browse." opens the class browser. RBBrowserEnvironment has not the method browse, so it works as general: opens the browser on CLASS not on the result of the query. The second one is incomplete. Should be "methods" instead of "browse". Or not?

p. 279 Question "Sending the message allNamed:in: to the class Pragma, we can identify the methods defining a particular pragma." - How is it possible? How can we identify somethig looking at "an Array( )"?

p. 282 typo "Starting from thisContext, haltIfCallChainContains:" should be "haltIfCallChain:contains:"

p. 283 Question "our proxy to inherit around 450 methods (!) from Object" Hmm, 479 is around 450. Ok. But 479 is closer to 500 :) May be "to inherit more 470 methods"?

p. 284

  • typo "point + (3@4) >>> 4@6" should be "(4@6)"
  • Question "Attempts to send these messages to non-boolean..." Something is unclear here: the message ifTrue: is sent to a boolean (yes, it's true) but whileTrue: is sent to a block.

p. 285 typo "point rectangle: (3@4) >>> 1@2 corner: 3@4" should be ">>> (1@2) corner: (3@4)"

p. 286 typo "In case the original message sent does not correspond to and instance" --> and?

Chapter 10

There is a contradiction with demonstration of the program code in the chapter: some code snippets are placed in the text (smoothly with the explanation), on the other hand, another parts of code are placed into separate listings without references to them. Only listings 10-6, 10-12, 10-14..18 are refernced, and others are not. What the aim was to separate code snippets from the text? For example, in the subsection 10-2 Everything is an Object the sentence "Here are two examples." is surrounded by other text, there are not code around it - there are THREE listings jumped to the top of the page. It is unclear.

p. 122 Error: "At the end of this chap�ter, we added an implementation note on the object implementation for the curious reader." is a wrong statment and shoud be removed because the corresponding section was removed from this version of the book.

p. 123 Error in Listing 10-4: a part of the caption became a part of the code

p. 126 "As a consequence, we can send the same message to different objects, each of which may have its own method for responding to the message.

In the previous examples, we do not decide how the SmallInteger 3..." somewhere here should be a reference to the Listings 10-7, 10-8. Or move the code snippets directly to the place. (would be better on my mind)

p. 132 Error in the Listing 10-14: should be "Morph >> openInWorldReturnSelf" as denoted in the text below.

p. 133 " Imagine that we define the following three methods:" - U-upss, there are not any code here! It is separated to the Listings at the top of the page. Should be a reference istead the ":" or move the code into the text.

pp. 134-135. We are talking about anEllipse in the text an Figure 10-19, but we have the message "EllipseMorph new constructorString". May be would be better to define (or explain) anEllipse := EllipseMorph new ?

p. 134

Error: "and the method fullPrintOn: BorderedMorph is found" - BorderedMorph should be deleted
"The message fullPrintOn: is looked up" should be "The method fullPrintOn: ..."
p. 136

Error: "Similarly, class instance variables are just instance variables defined by a metaclass (a class whose instances are classes):" - but a metaclass has only single class, not classES. Should be "(a class whose instance is a class)".
Error: "Sending the message now to the class Date is..." the class Date does not understand "now". Should be "Time now" or "Date today".
Question: "You will therefore find the method blue defined on the class side of Color, not on the instance side." is some confusing because I CAN find the method blue on the INSTANCE SIDE. It has another meaning then a class one, but... May be "Color paleBlue" would be better?
p. 137 What is the purpose of the Listings 10-21, 22, 23?

p. 141 A strange situation with code snippets that illustrate class instance variables: "Point class allInstVarNames" in the text and "WebServer class allInstVarNames" in the separate listing above. It is very hard to understand and to compare the results. It would be better to place both snippets to the text successively (as in the previous version). And WHY Point??? Earlier was "Object class allInstVarNames" that was natural.

p. 142 "We can now define a class method named uniqueInstance, as shown below." - Ups, Listing 10-32 is situated ABOVE

p. 143

Error: "Now we will look at an aspect of Pharo that is not so easily covered by our five rules: shared variables." There were SIX rules in the section 10.1
Error: "The variable Processor names an instance of ProcessScheduler" should be ProcessorScheduler
p. 144 Inconsistance: "Undeclared ... the browser will normally prompt you to declare it, for example as a global or as an instance variable of the class." No, it prompt to declare AS CLASS VARIABLE, not as an instance variable of the class :(

p. 146

A question: Listing 10-35 has not a method's selector, and ColorName is something invented. Is it good? Color has not variable ColorName.
typo: "TextConstants defines the variables CR that is bound..." shoud be "variable"
p. 147 typo: "eventhough" should be "even though"

p. 149 "Although Pharo supports only single in�heritance, it is easy to share implementations of methods by packaging them as traits." - should be removed because the corresponding subsection was moved to the next chapter of this version of the book.

New Chapter 5 typo

subsection 5.10 p. 48 "Since the initialize messsage is sent" - triple s - is it a long message? :)

Chapter 14

Many exapmles of code do not declare any local variables but use them. This contrasts with the previous chapters, where each used local variable were declared in | |.

p. 190 Figure 14-2: Linked Implementation / SkipList - such class not exist in Pharo now. Should be removed. Then look: Linked Implementation - only LinkedList; Interval Implementation - only Interval; all other classes use Arrayed Implementation directly or internally. So, is the Figure really usefull?

p. 194

Error: "new: anInteger creates a collection of size anInteger whose elements will all be nil." is true ONLY for arrays: common Array and specialized variants. String new: 3 >>> ' ' - not three nil. I think "new: aSize" do not belongs to the COMMON creation protocol.
Question: How about new? Set new, Dictionary new, OrderedCollection new - the usual way to create an empty collection. Why there are not any mension about "new" in the subsection Common creation protocol?
Error: "(1 to: 5) asOrderedCollection addAll: '678'; yourself" will return "an OrderedCollection(1 2 3 4 5 $6 $7 $8)" not the "an OrderedCollection(1 2 3 4 5 6 7 8)". It should be "(1 to: 5) asOrderedCollection addAll: #(6 7 8); yourself"
Question: is it really appropriate to show addAll: in the Common creation protocol subsection?
p. 197 Error: The paragraph "Be careful: general principle is that literal arrays are not be modified! Literal arrays are kept in compiled method literal frames (a space where literals ap�pearing in a method are stored), therefore unless you copy the array, the second time you execute the code your literal array may not have the value you expect. In the example, without copying the array, the second time around, the literal #(1 2 3 4 5 6) will actually be #(1 2 33 4 5 6)! Dynamic arrays do not have this problem because they are not stored in literal frames." is partially wrong. A literal array is immutable now.

p. 200 Error: "(1 to: 6) union: (4 to: 10) >>> a Set(1 2 3 4 5 6 7 8 9 10)" - the wrong answer, Collection>>union: uses self species, and Interval>>species returns Array, so such answer is impossible. Should be ">>> #(8 5 2 10 7 4 1 9 6 3)"

p. 203 Error: "the method copyReplaceAll:" should be "the method copyReplaceAll:with:"

p. 209

Contradiction: "The message detect:ifNone: is a variant of the METHOD detect:." Should be "The message detect:ifNone: is a variant of the message detect:." Or "method -- method".
Mathematical error: "we could write this expression to sum the first 100 integers: (1 to: 100)..." 1 is not "a first integer" but it is a first Natural number. So, it should be "the first 100 natural numbers:"
p. 210 "Smalltalk mistakes" or "Pharo mistakes"?

Numbers & Numbers

There are two subsections "Numbers" in the Chapter 13: 13.13 and 13.15
Nevertheless, the 13 is a magic number :)

A few typos at FirstApplication

First, this method toggles the state of the current cell. Then it sends the message ==value== to the object stored in the instance variable ==mouseAction==. In ==LOGame >> newCellAt: i at: j== we created the block ==[self toggleNeighboursOfCellAt: i at: j ]== which will all the neighbors of a cell when it is evaluated, and we assigned this block to the ==mouseAction== instance variable of the cell. Therefore sending the ==value== message causes this block to be evaluated, and consequently the state of the neighboring cells will toggle.

which will all the neighbors of a cell when it is evaluated

Looks like a verb is missing


https://github.com/SquareBracketAssociates/NewPharoByExample9/blob/e184a12b3ae769ed5eb164d1c3e5ed2a51326451/Chapters/FirstApplication/FirstApplication.pillar#L165C16-L165C21

5 @ 5

Later in text referenced as 50 @ 50


https://github.com/SquareBracketAssociates/NewPharoByExample9/blob/e184a12b3ae769ed5eb164d1c3e5ed2a51326451/Chapters/FirstApplication/FirstApplication.pillar#L225C1-L225C872

and if even if we thought we did know

I'm not sure about this one, but looks weird to me

Chapter 13

p. 169 A wrong statment: "RECALL that a package may add new functionality to a class even if it does not define this class." "Recall" is wrong: there is not any word about this neither in the previous chapters nor in the next ones.

p. 170 A reference to the Listing 13-1 is missing

p. 171 "The message storeOn: writes to its argument..." - message or method?

pp. 172-173 Should be references to The Listings

p. 174 typo: "13.6 About isKindOf: and respondTo:" should be "respondsTo:"

p. 175 Question: "Since instance variables are accessed by reference, a shallow copy of an object shares its references to instance variables with the original object." Really "are variables accessed by reference"? Or variables hold references to their values? Really "shares references to instance variables"? Or shares references to values? Each instance has its own set of instance variables, so "to share references to instance variables" isn't correct on my mind.

p. 177 "Stack>>pop could easily have been implemented as follows (note that this definition is anhypothetical example and not in the Pharo 8.0 system):" but

the Listing 13-6 is above the text, so how it can be "as follows"
Pharo 8.0 or 9.0?
p. 180

Error in Figure 13-10: LargeInteger missing. LargePositiveInteger and LargeNegativeInteger both are subclasses of LargeInteger.
"The remaining operators are generically defined. For example:" - Ups, the example jumped to the Listing to the top of the page.
p.181 ">>> 100@10 "Point creation" " Should be ">>> (100@10) "Point creation" "

p. 182 Error: "Fraction>>numerator:denominator:" Should be "Fraction class >> numerator:denominator:"

p. 183 "The protocol accessing untypeable characters contains a number of convenience constructor methods such as backspace, cr, escape, euro, space, tab, and so on." - the Character class >> euro do not belongs to that protocol, but it is an extension method.

p. 185 Error: "'hello' at: 2 put: $u; yourself" - the string literal is immutable

p. 186 "The implemen�tations in its concrete subclasses are both trivial:" again, the code jumped to the top

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.