- design principle of the day: - use polymorphism rather than explicit tests - replace "switch" statements with polymorphism - don't switch based on data - instead, let objects decide what functionality they should have for their own data - case study - research code that I'm currently writing - currently: - 2036 lines of code - 30 different classes/interfaces - 4 packages - _0_ case statements - 40 occurrences of the string "if" - 6 in comment strings - 4 in .equals() methods ==> down casts if (!(o instanceof ClassFoo)) { return false; } - 24 of remaining in single method - testing line segment intersection - lots of nasty sub-cases (parallel, degenerate segments, etc.) - I looked hard, but haven't found a better way to handle it (yet!) - otherwise, only _6_ if statements (and 2 of those go to support the big, nasty method!) - advice for RL alg params 0.3 <= \alpha <= 0.7 0.9 <= \gamma < 1