Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Elements of Computing Systems Chapter 6
Clone this wiki locally
After the hard-won success of last meeting, we recapped the progress we'd made with our finished
Computer and briefly mentioned a pull request to extract a
Decoder chip before cracking on with Chapter 6. As there were some frustrations last meeting, we discussed whether splitting into smaller teams would avoid some of the tension in the group. As there were only around seven of us, we decided to try the problems together but be mindful of past issues. We particularly stressed the importance of each agreeing whether to write the simplest possible thing to make progress (deferring refactoring to the end) or to refactor as we go. We opted for the former approach and ploughed on with Chapter 6.
Tom walked us through his
hack-assembler project and we decided to use it to test drive our solution to the exercises. With Leo at the keyboard, we worked our way through Tom's test cases, trying to be as conservative as possible in our approach and avoid getting side-tracked with refactoring:
- Enhancements to
Parser#has_more_commands?to support interleaved comments
Parser#compimplementation (as a particularly nifty one-liner that drew groans from some members of the group)
- Full two-pass assembler implementation
During the exercises, there was an interesting aside: we added a private
attr_reader to the
Parser like so:
class Parser private attr_reader :lines end
Tom mentioned that this actually raises a warning when running Ruby with warnings enabled (
warning: private attribute?). As a workaround, you actually have to use
private like so:
class Parser attr_reader :lines private :lines end
We managed to complete all the exercises and only ran over by a few minutes. For comparison, Tom then ran through his different solutions to the exercises and the varying performance of each. He has since posted more information about the different approaches to the mailing list but curiously the fastest implementation remains the one we wrote together.
We agreed to meet again in three weeks to discuss Chapter 7 with Leo and Geckoboard graciously offering to host once more.
Thanks to Geckoboard for hosting the meeting, Leo for driving and Tom for the