Appendix BAnswers to Exercises
You are writing a class called
Split, which splits input lines into fields. Which of the following two Java class signatures is the more orthogonal design?
Answer 1: To our way of thinking, class
Split2 is more orthogonal. It concentrates on its own task, splitting lines, and ignores details such as where the lines are coming from. Not only does this make the code easier to develop, but it also makes it more flexible.
Split2 can split lines read from a file, generated by another routine, or passed in via the environment.
Which will ...