3 ms·
I've been working on corrections and I was actually struck by how seemingly trivial differences in the languages can completely break large parts of the book. F
by extension 15y ago
I've been working on corrections and I was actually struck by how seemingly trivial differences in the languages can completely break large parts of the book. For example, the python version introduces modules fairly early because they are needed for other lessons. But I don't think there is a single library dependency in the entire Ruby version. It can't introduce require and then never use it, but there is very little entry level stuff in the Ruby standard library. There should probably be a chapter on making your own libraries, but that would have to be new material very late in the book.
- rsobers 15y agoHuh? require is used quite a bit: exercises 12, 25, 43, 47, 48, 50, 52. Some exercises depend on sinatra, some depend on test/unit, some depend on stuff you write yourself.
- extension 15y agoThe problem is it's teaching you Python's module system, which is very different from Ruby's require system. Ex. 12 introduces `require` with example code that is way over the reader's head at this point in the book, and unrelated to anything they have seen or will see until ex. 25. It also says that features are called "modules" but that's completely wrong -- Ruby modules are something else entirely. And the term "module" is used in the Python sense all over the book. All those need to be changed. Ex. 25 asks the reader to require their own file but never explains how to get the file in the load path, so I don't think the reader has much chance of completing this exercise. My point is that I don't think a direct per-exercise translation is going to work. Requires in Ruby are more complicated and used less often than modules in Python, and the book is very linear, so I think require will have to be introduced in a completely different way if it's going to make any sense. There are other topics that have this problem, like heredocs. In Python they are pretty so it's ok to throw them at the reader early on. But Ruby heredocs will melt their eyeballs out of their sockets, and they are rarely used in practice, so they probably shouldn't be in the book at all. I am working on these sorts of changes with the intention of sharing them with you to see what you think, but it's starting to snowball so I don't want to promise anything. I'll do my best.