Reading: Practical object-oriented design in ruby (ch. 6)
This work is due by 8:00pm on Thursday, 26 April 2018.
Read Chapter 6 of Practical Object-Oriented Design in Ruby.
For the journal send an email message to me titled “CSC 322.01 2018S Journal on Practical object-oriented design in ruby (ch. 6) (Your Name)” (without the quotation marks) and with answers to the following questions.
-
Metz’s discussion of inheritance shares some aspects with the way we typically discuss inheritance in CSC 207. Metz also introduces some different ways to think about inheritance. Describe the similarities and differences.
-
One key issue that Metz introduces in this chapter is ways to use inheritance as part of refactoring. Rather than starting with a well defined inheritance hierarchy, as our code grows, we discover opportunities to build that hierarchy. Describe at least one other technique for refactoring that Metz introduces in previous chapters.
-
Metz uses the “Template Method Pattern” to achieve some of the design of these classes. Explain that pattern to the best of your ability.
-
At the end of the chapter, Metz suggests that instead of having each subclass call
superin theinitializemethod, they instead include apost_initializemethod. What happens if a clueless newbie decides to subclassBicycleand accidentally includes aninitializemethod? -
What do you consider the most important takeaway from this chapter? Why?