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

AW: [XP] [refactoring] More on: Introduce Parameter Object

Expand Messages
  • Jauernig Andrea
    do you have a test that shows what this code should do for you? without knowing what you want to get, i think it´s impossible to find a bug ;) Birgit
    Message 1 of 1 , Mar 1, 2001
    • 0 Attachment
      do you have a test that shows what this code should do for you?
      without knowing what you want to get, i think it´s impossible to find a bug ;)

      Birgit

      > Immutable classes are easier to get right.
      >
      > Here is an example of mutable member variables, written in pseudo Java and
      > using pseudo ADO for db access.
      >
      > What's wrong with it? Can you spot the bug?
      >
      > class query_comparer {
      > private String m_q1, m_q2:
      > private Recordset m_r1, m_r2;
      >
      > public set_queries(String q1, String q2) throws DBException
      > {
      > m_r1 = db.Execute(q1);
      > m_r2 = db.Execute(q2);
      > m_q1 = q1;
      > m_q2 = q2;
      > }
      >
      > public show_differences(......
      > };
      >
      > Hardly anyone can. No wonder I find these almost every time I review code,
      > often from my own code, I have to admit.
      >
      > Kari
    Your message has been successfully submitted and would be delivered to recipients shortly.