To help myself learn more about Ruby, I'm starting to translate
chapter 1 of Refactoring [Fowler99] from java into ruby. I've
finished the first several rounds of refacotring but before I went any
further, I wanted to see if there was anything obviously with the code
I was putting together. (Obviously, some of the mistakes are
intentional -- I even had to go back and re-introduce some because
Martin cleaned them up in later examples.)
If you'd take a look at the code and let me know, I'd appreciate it.
http://pate.networkinglinuxbook.com/refactoringInRuby.tgz contains
this file and all of the code. The files correspond to [Fowler99] as
follows:
videostore.rb.orig pp 3-5 (the original code)
testVideoStore.rb.first -- (an initial runit set of tests)
videostore.rb.refactor1 p 11 (Extract Method)
videostore.rb.refactor1.fixed p 12 (clean up braino)
videostore.rb.refactor2 p 15 (rename variables)
videostore.rb.refactor3 p 17 (Move Method)
videostore.rb.refactor4 p 19 (clean up after Move)
videostore.rb.refactor5 p 21 (Replace Temp with Query)
videostore.rb.refactor6 p 23 (Extract Method)
videostore.rb.refactor7 p 27 (Replace Temp with Query)
videostore.rb.refactor8 p 29 (Replace Temp with Query)
testVideoStore.rb -- (add tests for html statement)
videostore.rb -- (new functionality added)
(Martin, this isn't ready to be linked to yet, but I'd love to hear your
ideas as well.)
thanks,
-pate