Distributed Services With Go - Ch 3 index errors on Config

In Chapter 3, the source for index introduces Config on page 31, followed by more code including tests; Config isn’t introduced until page 36. This causes compilation errors for anyone coding as they follow along.

3 Likes

Yeah this is subjective. I’ve had people saying they wanted the way it is currently so they can see how the type is used to see where it fits in before it’s defined.

2 Likes

For me, one of the worst experiences when coding along with books is when structures are left undefined like this. I feel it should at least be mentioned in the text that it will be defined later, and even then not left until after the tests. When this happens, there’s always the feeling in the back of my mind that the author has made a mistake (ever tried to read a packt book? :stuck_out_tongue: 90% of the ones I’ve seen are unreadable. There are a few gems though :smiley: ) Personally I would have defined it up front along with index, and explained it’s properties. That’s just my preference though.

2 Likes

Would like to chime in with @disknoir, while during the reading process it’s ok to see the data structure usage before it’s definition, but if you code along with the book it’s a super frustrating to see the tests, that actually you not able to run, because you missing some bits

1 Like