Loading ...
Sorry, an error occurred while loading the content.


Expand Messages
  • Blum, Robert
    [huge snip] ... If you think it communicates better - yes. (I sure hope you do) ... Well, there is the Rule of three - whenever you replicate something three
    Message 1 of 1 , Jan 30, 2002
    • 0 Attachment
      [huge snip]

      > So my dilemma is understanding a) should I make this "leap" to a
      > friendlier structure,

      If you think it communicates better - yes. (I sure hope you do)

      > b) how do I know when to make this leap -- more
      > specifically, what did I do when that caused me to want to go to this
      > other place,

      Well, there is the 'Rule of three' - whenever you replicate something three
      times, it is time to refactor. Since you had three if branches, time to
      refactor. And since switch statements/if-trees are a prime candidate for
      refactor->polymorphism, you do exactly that.

      > and c) how can I argue that the final answer isn't really
      > the "simplest thing that could possibly work" -- for me, I naturally
      > went there, well not first maybe, but surely second, and it is the
      > simplest thing for me.

      It is easier to read and communicates the same intent. Why would anybody NOT
      consider this simple?

      > The other one isn't simple, its only ugly.
      > Encapsulation, compartmentalization, a single handling mechanism, ...
      > all of those things feel simple to me. What exactly makes the last one
      > simpler???

      Expressiveness? It communicates your intent better than the other

    Your message has been successfully submitted and would be delivered to recipients shortly.