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

RE: [junit] Interfaces and Mock Objects

Expand Messages
  • Ilja Preuss
    ... Sounds a lot like the Interface Segregation Principle in action. :) Regards, Ilja
    Message 1 of 12 , Sep 1, 2003
    View Source
    • 0 Attachment
      J. B. Rainsberger wrote:
      > Next, I am experimenting with the following Java
      > implementation pattern.
      > A refactoring, I think.
      >
      > * Replace private/public separation with interface/implementation
      > separation.
      >
      > In other words, rather than make methods private, which can hurt
      > testing, extract a client interface and ship it to the client. Hide
      > creating instances behind factories. In other words, do like JDBC,
      > JMS, EJB...
      >
      > I like it. Thoughts?

      Sounds a lot like the Interface Segregation Principle in action. :)

      Regards, Ilja
    • J. B. Rainsberger
      ... I didn t know what name it had. Reference, please? -- J. B. Rainsberger, Diaspar Software Services http://www.diasparsoftware.com :: +1 416 791-8603 Let s
      Message 2 of 12 , Sep 1, 2003
      View Source
      • 0 Attachment
        Ilja Preuss wrote:

        > J. B. Rainsberger wrote:
        > > Next, I am experimenting with the following Java
        > > implementation pattern.
        > > A refactoring, I think.
        > >
        > > * Replace private/public separation with interface/implementation
        > > separation.
        > >
        > > In other words, rather than make methods private, which can hurt
        > > testing, extract a client interface and ship it to the client. Hide
        > > creating instances behind factories. In other words, do like JDBC,
        > > JMS, EJB...
        > >
        > > I like it. Thoughts?
        >
        > Sounds a lot like the Interface Segregation Principle in action. :)

        I didn't know what name it had. Reference, please?
        --
        J. B. Rainsberger,
        Diaspar Software Services
        http://www.diasparsoftware.com :: +1 416 791-8603
        Let's write software that people understand
      • Mike Clark
        ... http://www.objectmentor.com/resources/articles/isp.pdf Or, as you re always so fond of saying: Please Google Interface Segregation Principle . ... Mike
        Message 3 of 12 , Sep 1, 2003
        View Source
        • 0 Attachment
          J. B. Rainsberger wrote:

          >>
          >>Sounds a lot like the Interface Segregation Principle in action. :)
          >
          >
          > I didn't know what name it had. Reference, please?


          http://www.objectmentor.com/resources/articles/isp.pdf

          Or, as you're always so fond of saying: Please Google "Interface
          Segregation Principle".

          :-)

          Mike
        • David Postill
          On Mon, 01 Sep 2003 12:50:08 -0400, J. B. Rainsberger ... ... http://www.objectmentor.com/resources/articles/isp.pdf The
          Message 4 of 12 , Sep 1, 2003
          View Source
          • 0 Attachment
            On Mon, 01 Sep 2003 12:50:08 -0400, "J. B. Rainsberger" <jbrains@...>
            wrote:

            | Ilja Preuss wrote:

            <snip>

            | > Sounds a lot like the Interface Segregation Principle in action. :)
            |
            | I didn't know what name it had. Reference, please?


            http://www.objectmentor.com/resources/articles/isp.pdf The Interface
            Segregation Principle

            <davidp />

            --
            David Postill-----BEGIN PGP SIGNED MESSAGE-----
            Hash: SHA1

            On Mon, 01 Sep 2003 12:50:08 -0400, "J. B. Rainsberger" <jbrains@...>
            wrote:

            | Ilja Preuss wrote:

            <snip>

            | > Sounds a lot like the Interface Segregation Principle in action. :)
            |
            | I didn't know what name it had. Reference, please?


            http://www.objectmentor.com/resources/articles/isp.pdf The Interface
            Segregation Principle

            <davidp />

            - --
            David Postill

            -----BEGIN PGP SIGNATURE-----
            Version: PGP 8.0.2 - not licensed for commercial use: www.pgp.com
            Comment: Get key from pgpkeys.mit.edu:11370

            iQA/AwUBP1N/d3xp7q1nhFwUEQIYDQCgmjSZyTwDHVjWtEjaG077bzj098EAoIhV
            3AQ0RTjZ5ukFyOxlY0WVVdYr
            =3AcL
            -----END PGP SIGNATURE-----
          • Bob Koss
            ... I don t see it that way. ISP says clients should only have a source code dependency upon interfaces that they use. J.B. is suggesting taking private
            Message 5 of 12 , Sep 1, 2003
            View Source
            • 0 Attachment
              >
              >>>
              >>> Sounds a lot like the Interface Segregation Principle in action. :)
              >>

              I don't see it that way. ISP says clients should only have a source code
              dependency upon interfaces that they use. J.B. is suggesting taking private
              methods (which have only one client - the class itself) and putting them in
              another class - where they may or may not have more clients.

              I suppose if I squint just the right way I could argue that it's ISP.


              --
              Robert Koss, Ph.D. | Training, Mentoring, Contract Development
              Senior Consultant | Object Oriented Design, C++, Java
              www.objectmentor.com | Extreme Programming
            • Ilja Preuss
              ... Or http://c2.com/cgi/wiki?InterfaceSegregationPrinciple ... ROFL Regards, Ilja
              Message 6 of 12 , Sep 2, 2003
              View Source
              • 0 Attachment
                Mike Clark wrote:
                > http://www.objectmentor.com/resources/articles/isp.pdf

                Or http://c2.com/cgi/wiki?InterfaceSegregationPrinciple



                > Or, as you're always so fond of saying: Please Google "Interface
                > Segregation Principle".

                ROFL

                Regards, Ilja
              • Ilja Preuss
                ... As I understand it, he was suggesting something else in the post I replied to. Namely making the method public without moving it, but extracting an
                Message 7 of 12 , Sep 2, 2003
                View Source
                • 0 Attachment
                  Bob Koss wrote:
                  >>>> Sounds a lot like the Interface Segregation Principle in action. :)
                  >>>
                  >
                  > I don't see it that way. ISP says clients should only have a
                  > source code dependency upon interfaces that they use. J.B. is
                  > suggesting taking private methods (which have only one client
                  > - the class itself) and putting them in another class - where
                  > they may or may not have more clients.

                  As I understand it, he was suggesting something else in the post I
                  replied to. Namely making the method public without moving it, but
                  extracting an interface for the client which doesn't contain the
                  formerly private method. ISP, so it seems to me.

                  Regards, Ilja
                • J. B. Rainsberger
                  ... Has the Master not earned the right to expect the Student to pour the tea? :) I will remember to use Google. I will remember to use Google. I will remember
                  Message 8 of 12 , Sep 2, 2003
                  View Source
                  • 0 Attachment
                    Ilja Preuss wrote:

                    > Mike Clark wrote:
                    > > http://www.objectmentor.com/resources/articles/isp.pdf
                    >
                    > Or http://c2.com/cgi/wiki?InterfaceSegregationPrinciple
                    >
                    > > Or, as you're always so fond of saying: Please Google "Interface
                    > > Segregation Principle".
                    >
                    > ROFL

                    Has the Master not earned the right to expect the Student to pour the
                    tea? :)

                    I will remember to use Google.
                    I will remember to use Google.
                    I will remember to use Google.

                    [I typed those lines out myself -- no copy-and-paste, I swear!]
                    --
                    J. B. Rainsberger,
                    Diaspar Software Services
                    http://www.diasparsoftware.com :: +1 416 791-8603
                    Let's write software that people understand
                  Your message has been successfully submitted and would be delivered to recipients shortly.