By Developers, For Developers
PDF Pg | Paper Pg | Type | Description | Fixed on | Comments |
---|---|---|---|---|---|
3 | TYPO | “As we see here, it’s real easy…” | 2013-02-24 | ||
11 | TYPO | “Closure’s in Groovy are quite exceptional” | 2013-02-24 | ||
28 | TYPO | “Let’s wet our appetite by making use…” | 2013-02-24 | ||
89 | TYPO | “Closure in Groovy are short anonymous methods…” | 2013-02-24 | ||
0 | TYPO | Reading ePub version, therefore no page numbers. Introduction => Acknowledgements Section Title “Acknowledgments” should be Acknowledgements Then further down in in 4th para: “time to write the forward” should be “foreword”. | 2013-06-16 | ||
20 | SUGGEST | A minor point: On p. 20, you compare a Java class containing main() with a Groovy script. I understand your point that in Groovy you can just call a class in a script without using a main() method. However, the two versions are not directly equivalent, precisely because the Groovy script has lost the ability to be the main() function in a program with other modules, whereas the Java program has not. If you want to say the Groovy version is a shorter version of the Java version, I think you should point out that the Groovy version has slightly less capacity. Or perhaps show a second version of the Groovy example using main(). You do the same type of comparison with Java main() classes elsewhere in the book. If you search for “main” you’ll find other examples. | |||
400 | SUGGEST | No example of main() in Groovy anywhere in the book? Seems like an important omission. | |||
xvii | TYPO | soooo | |||
xviii | TYPO | and memory today than large computers had decades ago. it should be and memory today is larger than the large computers had decades ago. | |||
5 | ERROR | groovy:000> ‘mom’.l I am using JDK 1.6 and groovy 2.1.6. | |||
16 | ERROR | println “groovy -v”.execute().text This didn’t work for me on Windows 7. I get the following error. Caught: java.io.IOException: Cannot run program “groovy”: CreateProcess error=2, The system cannot find the file specified | |||
xvii | ERROR | You list a method for computing a 5% raise on 80,000. That would be 4,000. However, your method is this: Integer.metaClass.percentRaise = { amount -> amount * (1 + delegate / 100.0) } The “1 +” part here does not make sense to me. I would think the calculation would be: 80000 * (5 / 100.0) Which would mean the method should be this: Integer.metaClass.percentRaise = { amount -> amount * (delegate / 100.0) } A small issue, perhaps, but it might also be highlighting something I’m not understanding. | |||
16 | ERROR | You have an example like this: println “groovy -v”.execute().text You say: “This code sample works on Unix-like systems and on Windows.” However, when I test this out on a Windows machine, I find that it gives the following error: Caught: java.io.IOException: Cannot run program “groovy”: CreateProcess error=2, The system cannot find the file specified Note that “groovy” does work on my command line; I have GROOVY_HOME set and the GROOVY_HOME\\bin on my path. I can run groovy and groovysh from the command line without issue. You have to do this: println “cmd /C groovy -v”.execute().text You do mention the need to run ‘cmd’ directly later on the same page. You mention that you need to do this if you use the “dir” command but that’s not true. You can run this: println “dir”.execute().text without error. | |||
47 | SUGGEST | I would consider that some of your readers would experiment and maybe anticipate confusions. For example, on the WhatEquals script, you only run two tests: new A() new A() new B() new B() What I would do — and, in fact, did — was this: new A() new A() // equals
new A() new B() // equals That’s relevant because notice the third one? Groovy returns nothing at all. Maybe that makes sense to someone. But I’m certainly not sure why that result is the way it is; and this seems like a perfect spot in the book to explain why that is. | |||
22 | SUGGEST | On this page, you say: “To take advantage of this feature, define the first parameter as a Map.” However, it’s not clear to me that any of the parameters in the Robot class are a Map. A bit further down you say: “The instance of Robot took type, height, and width parameters as name-value pairs.” Okay, so it “took” them that way — but I didn’t define anything as a Map, did I? This is the part I’m not sure about. The confusion here is probably mine but I wonder if the wording could be clarified? | |||
26 | SUGGEST | I recommend an attempt to anticipate how people experiment. For example, on this page, I can try examples like this: def (verbPhrase, directObject, preposition, indirectObject) = [‘ask’, ‘bob’, ‘about’] That works in that even though I have four variables only three are returned. However, this does not work: def parse(command) { command.split(’ ’) } def (verbPhrase, directObject, preposition, indirectObject) = parse(“ask bob about”) It throws an exception. This is the case even though my parse() method is returning an array, which would seem to make my second example the same as the first. While I realize my examples are different from yours, they are logically the same and the likely experimentation path of most programmers reading this page. I bring this up because on this page, you say: “If the excess variable is a primitive type, something that can’t be set to null, But, again, clarifying with example is better than just words, particularly since my experimentation leads to a question as to how things are working. This is even moreso the case when you consider that this slight variation does work: def (verb, noun) = parse(“ask bob about the alien invasion”) | |||
16 | ERROR | Instead of the following which doesn’t work on windows. The following works on windows 7. since it’s a shell command. println " cmd /c groovy -v".execute().text Groovy Version: 2.1.6 JVM: 1.6.0_35 Vendor: Sun Microsystems Inc. OS: Windows 7 | |||
281 | ERROR | At this point in the book, when I run the test you have described, it does not pass as this page says it should. Rather I get this: testMyMethod(TestCodeWithHeavyDependenciesUsingOverriding)junit.framework.AssertionFailedError: expected:<35> but was: It looks to me like the someAction method in CodeWithHeavierDependenciesExt is not actually being executed. If I put output lines in both someAction() methods, I’m finding that only the one in the original class, not the Ext class, is executing. | |||
281 | TYPO | (I really wish these errata sections had an edit aspect so you can edit your own previous entries.) For the last one I posted on page 281 — (entry by Jeff Nyman) — it appears I was running the Java code version and that’s why I was seeing the error I was seeing. Part of the challenge is I was also going through the code from the downloadable distribution which has a ton of files in it. So the problem I report here is actually for the test that appears on page 282 and 283. | |||
112 | SUGGEST | You mention an eachWithIndex method but don’t show its usage. Granted, someone can look it up but it wouldn’t necessarily hurt to throw one line of code to showcase this: lst.eachWithIndex { obj, i -> print “${i}: ${obj} ” } Or something like that anyway. | |||
113 | SUGGEST | You mention the difference between iterating with each() and collect() but it’s mostly words and two disjointed examples. I think it might be better to show the difference like this: my_list = [1, 3, 4, 1, 8, 9, 2, 6] result = my_list.each { it * 2 } result = my_list.collect { it * 2 } I think examples like this can make the point a lot clearer. | |||
74 | SUGGEST | This page has the following text: “It stretches its hands and reaches out to the In my opinion, wording like that tends to hide rather than clarify meaning. I would more just state what is happening, particularly since the above can be misleading. | |||
50 | TYPO | First paragraph after code block at the top of the page class name referenced has a typo - Calibrartor instead of Calibrator. | |||
85 | TYPO | Minor nit - completeOrder() instead of computeOrder() in the first paragraph | |||
141 | ERROR | Chapter 7 (Exploring the GDK) under section 7.3: Custom Methods Using the Extension Modules. In Extension/FindPrice.groovy, the static and instance methods are switched up. You book says the following: println “Price for $ticker using instance method is ${String.getPrice(ticker)}” It should be something like this: println “Price for $ticker using static method is ${String.getPrice(ticker)}” // Changed instance to static | |||
141 | TYPO | Possible swapping of instance vs. static methods - just the labeling with the println of which method is static and which is instance. First one is labeled as instance but is static and vice-versa on the second println. | |||
70 | TYPO | Chapter 3: Static Compilation Should be (ie. the ‘p’ and ‘c’ are swapped incorrectly) | |||
253 | TYPO | Last paragraph sentence: | |||
1741 | SUGGEST | Note that the page number (1741) entered is the Kindle edition’s Location. In the section about ‘==’ in groovy versus java (WhatEquals.groovy is the source code) it would be good to mention that the operand on the left decides whether compareTo or equals is called. So, in your example, new A() new B() would output 'equals called' whereas new B() new A() would output ‘compareTo called’ Also note that if the objects are in fact the same reference, neither equals nor compareTo are called: def a = new A() | |||
135 | ERROR | The MODRANGEOUTPUT of “WorkingWithCollections/CreatingArrayList.groovy” produces a different output other than described in the book. Expected (see PDF page 135): Actual result (Using Groovy 2.2.1 JVM: 1.7.0_13 on Mac OS X) | |||
35 | SUGGEST | In script UsingCoffeeSize.groovy, the for-each loop can be | |||
37 | TYPO | MethodMissingException should be MissingMethodException | |||
xvii | TYPO | Soooo… is not a typo but the author is stressing “So”. | |||
52 | TYPO | def arr = [1, 2, 3, 4, 5] as int[] variable ‘arr’ should be ‘arr2’. | |||
152 | TYPO | At end of section 9.1, command to create the database without password should be: ..or with password: It does not work with the equals sign. |